Class: AdvancedBilling::Seller
- Defined in:
- lib/advanced_billing/models/seller.rb
Overview
Seller Model.
Instance Attribute Summary collapse
-
#address ⇒ InvoiceAddress
TODO: Write general description for this method.
-
#logo_url ⇒ String
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
-
#phone ⇒ String
TODO: Write general description for this method.
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.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(name = SKIP, address = SKIP, phone = SKIP, logo_url = SKIP) ⇒ Seller
constructor
A new instance of Seller.
Methods inherited from BaseModel
Constructor Details
#initialize(name = SKIP, address = SKIP, phone = SKIP, logo_url = SKIP) ⇒ Seller
Returns a new instance of Seller.
55 56 57 58 59 60 |
# File 'lib/advanced_billing/models/seller.rb', line 55 def initialize(name = SKIP, address = SKIP, phone = SKIP, logo_url = SKIP) @name = name unless name == SKIP @address = address unless address == SKIP @phone = phone unless phone == SKIP @logo_url = logo_url unless logo_url == SKIP end |
Instance Attribute Details
#address ⇒ InvoiceAddress
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/seller.rb', line 18 def address @address end |
#logo_url ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/seller.rb', line 26 def logo_url @logo_url end |
#name ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/seller.rb', line 14 def name @name end |
#phone ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/seller.rb', line 22 def phone @phone end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/advanced_billing/models/seller.rb', line 63 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : SKIP address = InvoiceAddress.from_hash(hash['address']) if hash['address'] phone = hash.key?('phone') ? hash['phone'] : SKIP logo_url = hash.key?('logo_url') ? hash['logo_url'] : SKIP # Create object from extracted values. Seller.new(name, address, phone, logo_url) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/advanced_billing/models/seller.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['address'] = 'address' @_hash['phone'] = 'phone' @_hash['logo_url'] = 'logo_url' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 52 53 |
# File 'lib/advanced_billing/models/seller.rb', line 49 def self.nullables %w[ logo_url ] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/advanced_billing/models/seller.rb', line 39 def self.optionals %w[ name address phone logo_url ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
81 82 83 84 85 86 87 |
# File 'lib/advanced_billing/models/seller.rb', line 81 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |