Class: Asdawqw::ManualPolicy

Inherits:
BaseModel show all
Defined in:
lib/asdawqw/models/manual_policy.rb

Overview

ManualPolicy Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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_policiesList of ManualPolicies

Model

Returns:



15
16
17
# File 'lib/asdawqw/models/manual_policy.rb', line 15

def manual_policies
  @manual_policies
end

#typeManualPolicyTypeEnum

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

.namesObject

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