Class: Asdawqw::CompanyAddress
- Defined in:
- lib/asdawqw/models/company_address.rb
Overview
CompanyAddress Model.
Instance Attribute Summary collapse
-
#city ⇒ String
City of PM.
-
#country ⇒ String
Country of PM.
-
#state ⇒ String
State (Region) of PM.
-
#street_address ⇒ String
Street address of PM.
-
#zip ⇒ String
Zip code (postal code) of PM.
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(country = nil, state = nil, street_address = nil, city = nil, zip = nil) ⇒ CompanyAddress
constructor
A new instance of CompanyAddress.
Methods inherited from BaseModel
Constructor Details
#initialize(country = nil, state = nil, street_address = nil, city = nil, zip = nil) ⇒ CompanyAddress
Returns a new instance of CompanyAddress.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/asdawqw/models/company_address.rb', line 40 def initialize(country = nil, state = nil, street_address = nil, city = nil, zip = nil) @country = country @state = state @street_address = street_address @city = city @zip = zip end |
Instance Attribute Details
#city ⇒ String
City of PM
23 24 25 |
# File 'lib/asdawqw/models/company_address.rb', line 23 def city @city end |
#country ⇒ String
Country of PM. Require 2 letter ISO code
11 12 13 |
# File 'lib/asdawqw/models/company_address.rb', line 11 def country @country end |
#state ⇒ String
State (Region) of PM. Required for US properties.
15 16 17 |
# File 'lib/asdawqw/models/company_address.rb', line 15 def state @state end |
#street_address ⇒ String
Street address of PM.
19 20 21 |
# File 'lib/asdawqw/models/company_address.rb', line 19 def street_address @street_address end |
#zip ⇒ String
Zip code (postal code) of PM.
27 28 29 |
# File 'lib/asdawqw/models/company_address.rb', line 27 def zip @zip end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/asdawqw/models/company_address.rb', line 53 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. country = hash['country'] state = hash['state'] street_address = hash['streetAddress'] city = hash['city'] zip = hash['zip'] # Create object from extracted values. CompanyAddress.new(country, state, street_address, city, zip) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 38 |
# File 'lib/asdawqw/models/company_address.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['country'] = 'country' @_hash['state'] = 'state' @_hash['street_address'] = 'streetAddress' @_hash['city'] = 'city' @_hash['zip'] = 'zip' @_hash end |