Class: ApiReference::LicenseUsageQueryParams

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/license_usage_query_params.rb

Overview

Base query parameters for license usage endpoints. Contains common parameters like date range, grouping, and pagination.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(start_date: SKIP, end_date: SKIP, group_by: SKIP, cursor: SKIP, limit: 20) ⇒ LicenseUsageQueryParams

Returns a new instance of LicenseUsageQueryParams.



68
69
70
71
72
73
74
75
# File 'lib/api_reference/models/license_usage_query_params.rb', line 68

def initialize(start_date: SKIP, end_date: SKIP, group_by: SKIP,
               cursor: SKIP, limit: 20)
  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
  @group_by = group_by unless group_by == SKIP
  @cursor = cursor unless cursor == SKIP
  @limit = limit unless limit == SKIP
end

Instance Attribute Details

#cursorString

Pagination cursor from a previous request.

Returns:

  • (String)


30
31
32
# File 'lib/api_reference/models/license_usage_query_params.rb', line 30

def cursor
  @cursor
end

#end_dateDate

End date for the usage period (YYYY-MM-DD). Defaults to end of current billing period.

Returns:

  • (Date)


21
22
23
# File 'lib/api_reference/models/license_usage_query_params.rb', line 21

def end_date
  @end_date
end

#group_byString

How to group the results. Valid values: 'license', 'day'. Can be combined (e.g., 'license,day').

Returns:

  • (String)


26
27
28
# File 'lib/api_reference/models/license_usage_query_params.rb', line 26

def group_by
  @group_by
end

#limitInteger

Maximum number of rows in the response data (default 20, max 100).

Returns:

  • (Integer)


34
35
36
# File 'lib/api_reference/models/license_usage_query_params.rb', line 34

def limit
  @limit
end

#start_dateDate

Start date for the usage period (YYYY-MM-DD). Defaults to start of current billing period.

Returns:

  • (Date)


16
17
18
# File 'lib/api_reference/models/license_usage_query_params.rb', line 16

def start_date
  @start_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/api_reference/models/license_usage_query_params.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  start_date = hash.key?('start_date') ? hash['start_date'] : SKIP
  end_date = hash.key?('end_date') ? hash['end_date'] : SKIP
  group_by = hash.key?('group_by') ? hash['group_by'] : SKIP
  cursor = hash.key?('cursor') ? hash['cursor'] : SKIP
  limit = hash['limit'] ||= 20

  # Create object from extracted values.
  LicenseUsageQueryParams.new(start_date: start_date,
                              end_date: end_date,
                              group_by: group_by,
                              cursor: cursor,
                              limit: limit)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
# File 'lib/api_reference/models/license_usage_query_params.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['start_date'] = 'start_date'
  @_hash['end_date'] = 'end_date'
  @_hash['group_by'] = 'group_by'
  @_hash['cursor'] = 'cursor'
  @_hash['limit'] = 'limit'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
62
63
64
65
66
# File 'lib/api_reference/models/license_usage_query_params.rb', line 59

def self.nullables
  %w[
    start_date
    end_date
    group_by
    cursor
  ]
end

.optionalsObject

An array for optional fields



48
49
50
51
52
53
54
55
56
# File 'lib/api_reference/models/license_usage_query_params.rb', line 48

def self.optionals
  %w[
    start_date
    end_date
    group_by
    cursor
    limit
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
# File 'lib/api_reference/models/license_usage_query_params.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} start_date: #{@start_date.inspect}, end_date: #{@end_date.inspect},"\
  " group_by: #{@group_by.inspect}, cursor: #{@cursor.inspect}, limit: #{@limit.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



97
98
99
100
101
# File 'lib/api_reference/models/license_usage_query_params.rb', line 97

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} start_date: #{@start_date}, end_date: #{@end_date}, group_by: #{@group_by},"\
  " cursor: #{@cursor}, limit: #{@limit}>"
end