Class: AdvancedBilling::InvoiceSeller
- Defined in:
- lib/advanced_billing/models/invoice_seller.rb
Overview
Information about the seller (merchant) listed on the masthead of the invoice.
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, additional_properties: {}) ⇒ InvoiceSeller
constructor
A new instance of InvoiceSeller.
Methods inherited from BaseModel
Constructor Details
#initialize(name: SKIP, address: SKIP, phone: SKIP, logo_url: SKIP, additional_properties: {}) ⇒ InvoiceSeller
Returns a new instance of InvoiceSeller.
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/advanced_billing/models/invoice_seller.rb', line 56 def initialize(name: SKIP, address: SKIP, phone: SKIP, logo_url: SKIP, additional_properties: {}) @name = name unless name == SKIP @address = address unless address == SKIP @phone = phone unless phone == SKIP @logo_url = logo_url unless logo_url == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#address ⇒ InvoiceAddress
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/invoice_seller.rb', line 19 def address @address end |
#logo_url ⇒ String
TODO: Write general description for this method
27 28 29 |
# File 'lib/advanced_billing/models/invoice_seller.rb', line 27 def logo_url @logo_url end |
#name ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/invoice_seller.rb', line 15 def name @name end |
#phone ⇒ String
TODO: Write general description for this method
23 24 25 |
# File 'lib/advanced_billing/models/invoice_seller.rb', line 23 def phone @phone end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/advanced_billing/models/invoice_seller.rb', line 70 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 # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. InvoiceSeller.new(name: name, address: address, phone: phone, logo_url: logo_url, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 |
# File 'lib/advanced_billing/models/invoice_seller.rb', line 30 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
50 51 52 53 54 |
# File 'lib/advanced_billing/models/invoice_seller.rb', line 50 def self.nullables %w[ logo_url ] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 46 47 |
# File 'lib/advanced_billing/models/invoice_seller.rb', line 40 def self.optionals %w[ name address phone logo_url ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
92 93 94 95 96 97 98 |
# File 'lib/advanced_billing/models/invoice_seller.rb', line 92 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |