Class: Asdawqw::CompanyDetails
- Defined in:
- lib/asdawqw/models/company_details.rb
Overview
CompanyDetails Model.
Instance Attribute Summary collapse
-
#account_id ⇒ String
Unique ID of PM in PMS.
-
#company_address ⇒ CompanyAddress
Model.
-
#company_name ⇒ String
Name of PM.
-
#currency ⇒ String
PM default currency.
-
#email ⇒ String
Email of PM.
-
#full_name ⇒ String
First and Last Name.
-
#language ⇒ String
Language 2 letter value as ISO 639-1 code.
-
#password ⇒ String
Password for accessing PM.
-
#phone ⇒ Phone
Model.
-
#website ⇒ String
Company (PM) website URL.
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(account_id = nil, company_name = nil, language = nil, full_name = nil, company_address = nil, website = nil, email = nil, phone = nil, currency = nil, password = nil) ⇒ CompanyDetails
constructor
A new instance of CompanyDetails.
Methods inherited from BaseModel
Constructor Details
#initialize(account_id = nil, company_name = nil, language = nil, full_name = nil, company_address = nil, website = nil, email = nil, phone = nil, currency = nil, password = nil) ⇒ CompanyDetails
Returns a new instance of CompanyDetails.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/asdawqw/models/company_details.rb', line 70 def initialize(account_id = nil, company_name = nil, language = nil, full_name = nil, company_address = nil, website = nil, email = nil, phone = nil, currency = nil, password = nil) @account_id = account_id @company_name = company_name @language = language @full_name = full_name @company_address = company_address @website = website @email = email @phone = phone @password = password @currency = currency end |
Instance Attribute Details
#account_id ⇒ String
Unique ID of PM in PMS
11 12 13 |
# File 'lib/asdawqw/models/company_details.rb', line 11 def account_id @account_id end |
#company_address ⇒ CompanyAddress
Model
27 28 29 |
# File 'lib/asdawqw/models/company_details.rb', line 27 def company_address @company_address end |
#company_name ⇒ String
Name of PM
15 16 17 |
# File 'lib/asdawqw/models/company_details.rb', line 15 def company_name @company_name end |
#currency ⇒ String
PM default currency. ISO 4217 code is required
52 53 54 |
# File 'lib/asdawqw/models/company_details.rb', line 52 def currency @currency end |
#email ⇒ String
Email of PM. Email need to be unique in BP system, so you might receive error if we already have this email in our system
36 37 38 |
# File 'lib/asdawqw/models/company_details.rb', line 36 def email @email end |
#full_name ⇒ String
First and Last Name
23 24 25 |
# File 'lib/asdawqw/models/company_details.rb', line 23 def full_name @full_name end |
#language ⇒ String
Language 2 letter value as ISO 639-1 code
19 20 21 |
# File 'lib/asdawqw/models/company_details.rb', line 19 def language @language end |
#password ⇒ String
Password for accessing PM. If the password is not passed in the request random password will be generated and returned in response. Password will be in response only on create and if it is manually generated. Special characters are not allowed, instead use UTF-8 codes, for example instead of # use %23
48 49 50 |
# File 'lib/asdawqw/models/company_details.rb', line 48 def password @password end |
#phone ⇒ Phone
Model
40 41 42 |
# File 'lib/asdawqw/models/company_details.rb', line 40 def phone @phone end |
#website ⇒ String
Company (PM) website URL
31 32 33 |
# File 'lib/asdawqw/models/company_details.rb', line 31 def website @website end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/asdawqw/models/company_details.rb', line 93 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_id = hash['accountId'] company_name = hash['companyName'] language = hash['language'] full_name = hash['fullName'] company_address = CompanyAddress.from_hash(hash['companyAddress']) if hash['companyAddress'] website = hash['website'] email = hash['email'] phone = Phone.from_hash(hash['phone']) if hash['phone'] currency = hash['currency'] password = hash['password'] # Create object from extracted values. CompanyDetails.new(account_id, company_name, language, full_name, company_address, website, email, phone, currency, password) end |
.names ⇒ Object
A mapping from model property names to API property names.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/asdawqw/models/company_details.rb', line 55 def self.names @_hash = {} if @_hash.nil? @_hash['account_id'] = 'accountId' @_hash['company_name'] = 'companyName' @_hash['language'] = 'language' @_hash['full_name'] = 'fullName' @_hash['company_address'] = 'companyAddress' @_hash['website'] = 'website' @_hash['email'] = 'email' @_hash['phone'] = 'phone' @_hash['password'] = 'password' @_hash['currency'] = 'currency' @_hash end |