Class: Asdawqw::Company
- Defined in:
- lib/asdawqw/models/company.rb
Overview
Company model
Instance Attribute Summary collapse
-
#company_details ⇒ CompanyDetails
Company Details Model.
-
#id ⇒ Integer
Supplier id.
-
#payment ⇒ Payment
Payment Model.
-
#policies ⇒ Policies
Policies Model.
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(company_details = nil, policies = nil, payment = nil, id = nil) ⇒ Company
constructor
A new instance of Company.
Methods inherited from BaseModel
Constructor Details
#initialize(company_details = nil, policies = nil, payment = nil, id = nil) ⇒ Company
Returns a new instance of Company.
35 36 37 38 39 40 41 42 43 |
# File 'lib/asdawqw/models/company.rb', line 35 def initialize(company_details = nil, policies = nil, payment = nil, id = nil) @company_details = company_details @policies = policies @payment = payment @id = id end |
Instance Attribute Details
#company_details ⇒ CompanyDetails
Company Details Model
11 12 13 |
# File 'lib/asdawqw/models/company.rb', line 11 def company_details @company_details end |
#id ⇒ Integer
Supplier id. Not expected in any requests. Will be only in responses.
23 24 25 |
# File 'lib/asdawqw/models/company.rb', line 23 def id @id end |
#payment ⇒ Payment
Payment Model
19 20 21 |
# File 'lib/asdawqw/models/company.rb', line 19 def payment @payment end |
#policies ⇒ Policies
Policies Model
15 16 17 |
# File 'lib/asdawqw/models/company.rb', line 15 def policies @policies end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/asdawqw/models/company.rb', line 46 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. company_details = CompanyDetails.from_hash(hash['companyDetails']) if hash['companyDetails'] policies = Policies.from_hash(hash['policies']) if hash['policies'] payment = Payment.from_hash(hash['payment']) if hash['payment'] id = hash['id'] # Create object from extracted values. Company.new(company_details, policies, payment, id) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 33 |
# File 'lib/asdawqw/models/company.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['company_details'] = 'companyDetails' @_hash['policies'] = 'policies' @_hash['payment'] = 'payment' @_hash['id'] = 'id' @_hash end |