class Beaver::TransactionsSummary
TransactionsSummary
Model.
Attributes
currency[RW]
TODO: Write general description for this method @return [CurrencyEnum]
day[RW]
TODO: Write general description for this method @return [Integer]
item_count[RW]
TODO: Write general description for this method @return [Integer]
month[RW]
TODO: Write general description for this method @return [Integer]
summaries[RW]
TODO: Write general description for this method @return [List of TransactionsSummarySummaries]
total_amount[RW]
TODO: Write general description for this method @return [Integer]
year[RW]
TODO: Write general description for this method @return [Integer]
Public Class Methods
from_hash(hash)
click to toggle source
Creates an instance of the object from a hash.
# File lib/beaver/models/transactions_summary.rb, line 67 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. day = hash['day'] month = hash['month'] year = hash['year'] currency = hash['currency'] total_amount = hash['total_amount'] item_count = hash['item_count'] # Parameter is an array, so we need to iterate through it summaries = nil unless hash['summaries'].nil? summaries = [] hash['summaries'].each do |structure| summaries << (TransactionsSummarySummaries.from_hash(structure) if structure) end end # Create object from extracted values. TransactionsSummary.new(day, month, year, currency, total_amount, item_count, summaries) end
names()
click to toggle source
A mapping from model property names to API property names.
# File lib/beaver/models/transactions_summary.rb, line 38 def self.names @_hash = {} if @_hash.nil? @_hash['day'] = 'day' @_hash['month'] = 'month' @_hash['year'] = 'year' @_hash['currency'] = 'currency' @_hash['total_amount'] = 'total_amount' @_hash['item_count'] = 'item_count' @_hash['summaries'] = 'summaries' @_hash end
new(day = nil, month = nil, year = nil, currency = nil, total_amount = nil, item_count = nil, summaries = nil)
click to toggle source
# File lib/beaver/models/transactions_summary.rb, line 50 def initialize(day = nil, month = nil, year = nil, currency = nil, total_amount = nil, item_count = nil, summaries = nil) @day = day @month = month @year = year @currency = currency @total_amount = total_amount @item_count = item_count @summaries = summaries end