Class: MistApi::MspLicenseAction

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

Overview

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

Returns a new instance of MspLicenseAction.



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

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_idString

Required if ‘op`==`unamend`

Returns:

  • (String)


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

def amendment_id
  @amendment_id
end

#dst_org_idUUID | String

Required if ‘op`==`amend`, destination org id

Returns:

  • (UUID | String)


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

def dst_org_id
  @dst_org_id
end

#notesString

Required if ‘op`==`annotate`

Returns:

  • (String)


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

def notes
  @notes
end

#opMspLicenseActionOperationEnum

enum: ‘amend`, `annotate`, `delete`, `unamend`



26
27
28
# File 'lib/mist_api/models/msp_license_action.rb', line 26

def op
  @op
end

#quantityFloat

Required if ‘op`==`amend`

Returns:

  • (Float)


30
31
32
# File 'lib/mist_api/models/msp_license_action.rb', line 30

def quantity
  @quantity
end

#subscription_idString

Required if ‘op`==`annotate`

Returns:

  • (String)


34
35
36
# File 'lib/mist_api/models/msp_license_action.rb', line 34

def subscription_id
  @subscription_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



80
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
# File 'lib/mist_api/models/msp_license_action.rb', line 80

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



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

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



60
61
62
# File 'lib/mist_api/models/msp_license_action.rb', line 60

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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.



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

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.



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

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