Class: MistApi::OrgLicenseAction

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/org_license_action.rb

Overview

OrgLicenseAction 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(op = nil, amendment_id = SKIP, dst_org_id = SKIP, notes = SKIP, quantity = SKIP, subscription_id = SKIP, additional_properties = nil) ⇒ OrgLicenseAction

Returns a new instance of OrgLicenseAction.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/mist_api/models/org_license_action.rb', line 65

def initialize(op = nil, amendment_id = SKIP, dst_org_id = SKIP,
               notes = SKIP, quantity = SKIP, subscription_id = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @amendment_id = amendment_id unless amendment_id == SKIP
  @dst_org_id = dst_org_id unless dst_org_id == SKIP
  @notes = notes unless notes == SKIP
  @op = op
  @quantity = quantity unless quantity == SKIP
  @subscription_id = subscription_id unless subscription_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amendment_idUUID | String

If ‘op`==`unamend`, the ID of the operation to cancel

Returns:

  • (UUID | String)


14
15
16
# File 'lib/mist_api/models/org_license_action.rb', line 14

def amendment_id
  @amendment_id
end

#dst_org_idUUID | String

If ‘op`==`amend`, the id of the org where the license is moved

Returns:

  • (UUID | String)


18
19
20
# File 'lib/mist_api/models/org_license_action.rb', line 18

def dst_org_id
  @dst_org_id
end

#notesString

If ‘op`==`annotate`

Returns:

  • (String)


22
23
24
# File 'lib/mist_api/models/org_license_action.rb', line 22

def notes
  @notes
end

#opOrgLicenseActionOperationEnum

to move a license, use the ‘amend` operation. enum: `amend`, `annotate`, `delete`, `unamend`



27
28
29
# File 'lib/mist_api/models/org_license_action.rb', line 27

def op
  @op
end

#quantityInteger

If ‘op`==`amend`, the number of licenses to move

Returns:

  • (Integer)


31
32
33
# File 'lib/mist_api/models/org_license_action.rb', line 31

def quantity
  @quantity
end

#subscription_idString

If ‘op`==`amend` or `op`==`delete`, the ID of the subscription to use

Returns:

  • (String)


35
36
37
# File 'lib/mist_api/models/org_license_action.rb', line 35

def subscription_id
  @subscription_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/mist_api/models/org_license_action.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  op = hash.key?('op') ? hash['op'] : nil
  amendment_id = hash.key?('amendment_id') ? hash['amendment_id'] : SKIP
  dst_org_id = hash.key?('dst_org_id') ? hash['dst_org_id'] : SKIP
  notes = hash.key?('notes') ? hash['notes'] : SKIP
  quantity = hash.key?('quantity') ? hash['quantity'] : SKIP
  subscription_id =
    hash.key?('subscription_id') ? hash['subscription_id'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  OrgLicenseAction.new(op,
                       amendment_id,
                       dst_org_id,
                       notes,
                       quantity,
                       subscription_id,
                       additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/mist_api/models/org_license_action.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amendment_id'] = 'amendment_id'
  @_hash['dst_org_id'] = 'dst_org_id'
  @_hash['notes'] = 'notes'
  @_hash['op'] = 'op'
  @_hash['quantity'] = 'quantity'
  @_hash['subscription_id'] = 'subscription_id'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/mist_api/models/org_license_action.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
# File 'lib/mist_api/models/org_license_action.rb', line 50

def self.optionals
  %w[
    amendment_id
    dst_org_id
    notes
    quantity
    subscription_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



119
120
121
122
123
124
125
# File 'lib/mist_api/models/org_license_action.rb', line 119

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} amendment_id: #{@amendment_id.inspect}, dst_org_id: #{@dst_org_id.inspect},"\
  " notes: #{@notes.inspect}, op: #{@op.inspect}, quantity: #{@quantity.inspect},"\
  " subscription_id: #{@subscription_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



111
112
113
114
115
116
# File 'lib/mist_api/models/org_license_action.rb', line 111

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} amendment_id: #{@amendment_id}, dst_org_id: #{@dst_org_id}, notes:"\
  " #{@notes}, op: #{@op}, quantity: #{@quantity}, subscription_id: #{@subscription_id},"\
  " additional_properties: #{@additional_properties}>"
end