Class: AdvancedBilling::SiteSummary
- Defined in:
- lib/advanced_billing/models/site_summary.rb
Overview
SiteSummary Model.
Instance Attribute Summary collapse
-
#seller_name ⇒ String
TODO: Write general description for this method.
-
#site_currency ⇒ String
TODO: Write general description for this method.
-
#site_id ⇒ Integer
TODO: Write general description for this method.
-
#site_name ⇒ String
TODO: Write general description for this method.
-
#stats ⇒ SiteStatistics
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.
Instance Method Summary collapse
-
#initialize(seller_name: SKIP, site_name: SKIP, site_id: SKIP, site_currency: SKIP, stats: SKIP, additional_properties: {}) ⇒ SiteSummary
constructor
A new instance of SiteSummary.
Methods inherited from BaseModel
Constructor Details
#initialize(seller_name: SKIP, site_name: SKIP, site_id: SKIP, site_currency: SKIP, stats: SKIP, additional_properties: {}) ⇒ SiteSummary
Returns a new instance of SiteSummary.
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/advanced_billing/models/site_summary.rb', line 59 def initialize(seller_name: SKIP, site_name: SKIP, site_id: SKIP, site_currency: SKIP, stats: SKIP, additional_properties: {}) @seller_name = seller_name unless seller_name == SKIP @site_name = site_name unless site_name == SKIP @site_id = site_id unless site_id == SKIP @site_currency = site_currency unless site_currency == SKIP @stats = stats unless stats == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#seller_name ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/site_summary.rb', line 14 def seller_name @seller_name end |
#site_currency ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/site_summary.rb', line 26 def site_currency @site_currency end |
#site_id ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/site_summary.rb', line 22 def site_id @site_id end |
#site_name ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/site_summary.rb', line 18 def site_name @site_name end |
#stats ⇒ SiteStatistics
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/site_summary.rb', line 30 def stats @stats end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/advanced_billing/models/site_summary.rb', line 74 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. seller_name = hash.key?('seller_name') ? hash['seller_name'] : SKIP site_name = hash.key?('site_name') ? hash['site_name'] : SKIP site_id = hash.key?('site_id') ? hash['site_id'] : SKIP site_currency = hash.key?('site_currency') ? hash['site_currency'] : SKIP stats = SiteStatistics.from_hash(hash['stats']) if hash['stats'] # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. SiteSummary.new(seller_name: seller_name, site_name: site_name, site_id: site_id, site_currency: site_currency, stats: stats, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/advanced_billing/models/site_summary.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['seller_name'] = 'seller_name' @_hash['site_name'] = 'site_name' @_hash['site_id'] = 'site_id' @_hash['site_currency'] = 'site_currency' @_hash['stats'] = 'stats' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/advanced_billing/models/site_summary.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/advanced_billing/models/site_summary.rb', line 44 def self.optionals %w[ seller_name site_name site_id site_currency stats ] end |