Class: ApiReference::LicenseUsageByTypeQueryParams

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

Overview

Query parameters for GET /v1/licenses/usage Requires subscription_id and license_type_id to get usage for all licenses of a given type on a subscription.

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(subscription_id:, license_type_id:, start_date: SKIP, end_date: SKIP, group_by: SKIP, cursor: SKIP, limit: 20) ⇒ LicenseUsageByTypeQueryParams

Returns a new instance of LicenseUsageByTypeQueryParams.



79
80
81
82
83
84
85
86
87
88
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 79

def initialize(subscription_id:, license_type_id:, 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
  @subscription_id = subscription_id
  @license_type_id = license_type_id
end

Instance Attribute Details

#cursorString

Pagination cursor from a previous request.

Returns:

  • (String)


31
32
33
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 31

def cursor
  @cursor
end

#end_dateDate

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

Returns:

  • (Date)


22
23
24
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 22

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)


27
28
29
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 27

def group_by
  @group_by
end

#license_type_idString

The license type ID to filter licenses by.

Returns:

  • (String)


43
44
45
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 43

def license_type_id
  @license_type_id
end

#limitInteger

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

Returns:

  • (Integer)


35
36
37
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 35

def limit
  @limit
end

#start_dateDate

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

Returns:

  • (Date)


17
18
19
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 17

def start_date
  @start_date
end

#subscription_idString

The subscription ID to get license usage for.

Returns:

  • (String)


39
40
41
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 39

def subscription_id
  @subscription_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 91

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  subscription_id =
    hash.key?('subscription_id') ? hash['subscription_id'] : nil
  license_type_id =
    hash.key?('license_type_id') ? hash['license_type_id'] : nil
  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.
  LicenseUsageByTypeQueryParams.new(subscription_id: subscription_id,
                                    license_type_id: license_type_id,
                                    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.



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

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['subscription_id'] = 'subscription_id'
  @_hash['license_type_id'] = 'license_type_id'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
73
74
75
76
77
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 70

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

.optionalsObject

An array for optional fields



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

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.



124
125
126
127
128
129
130
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 124

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},"\
  " subscription_id: #{@subscription_id.inspect}, license_type_id:"\
  " #{@license_type_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



116
117
118
119
120
121
# File 'lib/api_reference/models/license_usage_by_type_query_params.rb', line 116

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}, subscription_id: #{@subscription_id},"\
  " license_type_id: #{@license_type_id}>"
end