Class: ApiReference::LicenseUsageByExternalIdQueryParams

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

Overview

Query parameters for GET /v1/licenses/external_licenses/<external_license_id>/usage The external_license_id is provided as a path parameter. Requires subscription_id to identify which subscription the license belongs to.

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) ⇒ LicenseUsageByExternalIdQueryParams

Returns a new instance of LicenseUsageByExternalIdQueryParams.



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

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)


32
33
34
# File 'lib/api_reference/models/license_usage_by_external_id_query_params.rb', line 32

def cursor
  @cursor
end

#end_dateDate

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

Returns:

  • (Date)


23
24
25
# File 'lib/api_reference/models/license_usage_by_external_id_query_params.rb', line 23

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)


28
29
30
# File 'lib/api_reference/models/license_usage_by_external_id_query_params.rb', line 28

def group_by
  @group_by
end

#license_type_idString

The license type ID to filter licenses by.

Returns:

  • (String)


44
45
46
# File 'lib/api_reference/models/license_usage_by_external_id_query_params.rb', line 44

def license_type_id
  @license_type_id
end

#limitInteger

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

Returns:

  • (Integer)


36
37
38
# File 'lib/api_reference/models/license_usage_by_external_id_query_params.rb', line 36

def limit
  @limit
end

#start_dateDate

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

Returns:

  • (Date)


18
19
20
# File 'lib/api_reference/models/license_usage_by_external_id_query_params.rb', line 18

def start_date
  @start_date
end

#subscription_idString

The subscription ID to get license usage for.

Returns:

  • (String)


40
41
42
# File 'lib/api_reference/models/license_usage_by_external_id_query_params.rb', line 40

def subscription_id
  @subscription_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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.
  LicenseUsageByExternalIdQueryParams.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.



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

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



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

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

.optionalsObject

An array for optional fields



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

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.



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

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.



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

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