Class: ApiReference::NewLicense

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

Overview

NewLicense Model.

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:, external_license_id:, start_date: SKIP, end_date: SKIP) ⇒ NewLicense

Returns a new instance of NewLicense.



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

def initialize(subscription_id:, license_type_id:, external_license_id:,
               start_date: SKIP, end_date: SKIP)
  @subscription_id = subscription_id
  @license_type_id = license_type_id
  @external_license_id = external_license_id
  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
end

Instance Attribute Details

#end_dateDate

The end date of the license. If not provided, the license will remain active until deactivated.

Returns:

  • (Date)


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

def end_date
  @end_date
end

#external_license_idString

The external identifier for the license.

Returns:

  • (String)


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

def external_license_id
  @external_license_id
end

#license_type_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def license_type_id
  @license_type_id
end

#start_dateDate

The start date of the license. If not provided, defaults to start of day today in the customer's timezone.

Returns:

  • (Date)


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

def start_date
  @start_date
end

#subscription_idString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/api_reference/models/new_license.rb', line 14

def subscription_id
  @subscription_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/api_reference/models/new_license.rb', line 71

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
  external_license_id =
    hash.key?('external_license_id') ? hash['external_license_id'] : nil
  start_date = hash.key?('start_date') ? hash['start_date'] : SKIP
  end_date = hash.key?('end_date') ? hash['end_date'] : SKIP

  # Create object from extracted values.
  NewLicense.new(subscription_id: subscription_id,
                 license_type_id: license_type_id,
                 external_license_id: external_license_id,
                 start_date: start_date,
                 end_date: end_date)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/api_reference/models/new_license.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['subscription_id'] = 'subscription_id'
  @_hash['license_type_id'] = 'license_type_id'
  @_hash['external_license_id'] = 'external_license_id'
  @_hash['start_date'] = 'start_date'
  @_hash['end_date'] = 'end_date'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
57
58
59
# File 'lib/api_reference/models/new_license.rb', line 54

def self.nullables
  %w[
    start_date
    end_date
  ]
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
# File 'lib/api_reference/models/new_license.rb', line 46

def self.optionals
  %w[
    start_date
    end_date
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



101
102
103
104
105
106
# File 'lib/api_reference/models/new_license.rb', line 101

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

#to_sObject

Provides a human-readable string representation of the object.



93
94
95
96
97
98
# File 'lib/api_reference/models/new_license.rb', line 93

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