Class: Asdawqw::ManualPolicy
- Defined in:
- lib/asdawqw/models/manual_policy.rb
Overview
ManualPolicy Model.
Instance Attribute Summary collapse
-
#manual_policies ⇒ List of ManualPolicies
Model.
-
#type ⇒ ManualPolicyTypeEnum
PERCENTAGE,FLAT.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(type = nil, manual_policies = nil) ⇒ ManualPolicy
constructor
A new instance of ManualPolicy.
Methods inherited from BaseModel
Constructor Details
#initialize(type = nil, manual_policies = nil) ⇒ ManualPolicy
Returns a new instance of ManualPolicy.
25 26 27 28 29 |
# File 'lib/asdawqw/models/manual_policy.rb', line 25 def initialize(type = nil, manual_policies = nil) @type = type @manual_policies = manual_policies end |
Instance Attribute Details
#manual_policies ⇒ List of ManualPolicies
Model
15 16 17 |
# File 'lib/asdawqw/models/manual_policy.rb', line 15 def manual_policies @manual_policies end |
#type ⇒ ManualPolicyTypeEnum
PERCENTAGE,FLAT
11 12 13 |
# File 'lib/asdawqw/models/manual_policy.rb', line 11 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/asdawqw/models/manual_policy.rb', line 32 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. type = hash['type'] # Parameter is an array, so we need to iterate through it manual_policies = nil unless hash['manualPolicies'].nil? manual_policies = [] hash['manualPolicies'].each do |structure| manual_policies << (ManualPolicies.from_hash(structure) if structure) end end # Create object from extracted values. ManualPolicy.new(type, manual_policies) end |
.names ⇒ Object
A mapping from model property names to API property names.
18 19 20 21 22 23 |
# File 'lib/asdawqw/models/manual_policy.rb', line 18 def self.names @_hash = {} if @_hash.nil? @_hash['type'] = 'type' @_hash['manual_policies'] = 'manualPolicies' @_hash end |