Class: Batches::BrandBreakdownItem
- Defined in:
- lib/batches/models/brand_breakdown_item.rb
Overview
BrandBreakdownItem Model.
Instance Attribute Summary collapse
-
#amount ⇒ String
The batch amount that is an aggregation of all the transactions' amounts in the batch for this brand.
-
#brand ⇒ BrandBatchesBrandBreakdownBrand
Indicates the card brand that this batch summary pertains to.
-
#count ⇒ Float
The number of transactions in the batch for this brand.
-
#funding_credit ⇒ FundingCredit1
The amount that is an aggregation of all the transactions' gratuity amounts in the batch for this brand.
-
#funding_debit ⇒ FundingDebit1
The amount that is an aggregation of all the transactions' gratuity amounts in the batch for this brand.
-
#gratuity_amount ⇒ String
The amount that is an aggregation of all the transactions' gratuity amounts in the batch for this brand.
-
#refunds ⇒ Refunds1
The amount that is an aggregation of all the transactions' gratuity amounts in the batch for this brand.
-
#sales ⇒ Sales1
The amount that is an aggregation of all the transactions' gratuity amounts in the batch for this brand.
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(brand: SKIP, amount: SKIP, count: SKIP, gratuity_amount: SKIP, sales: SKIP, refunds: SKIP, funding_debit: SKIP, funding_credit: SKIP, additional_properties: nil) ⇒ BrandBreakdownItem
constructor
A new instance of BrandBreakdownItem.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(brand: SKIP, amount: SKIP, count: SKIP, gratuity_amount: SKIP, sales: SKIP, refunds: SKIP, funding_debit: SKIP, funding_credit: SKIP, additional_properties: nil) ⇒ BrandBreakdownItem
Returns a new instance of BrandBreakdownItem.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 89 def initialize(brand: SKIP, amount: SKIP, count: SKIP, gratuity_amount: SKIP, sales: SKIP, refunds: SKIP, funding_debit: SKIP, funding_credit: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @brand = brand unless brand == SKIP @amount = amount unless amount == SKIP @count = count unless count == SKIP @gratuity_amount = gratuity_amount unless gratuity_amount == SKIP @sales = sales unless sales == SKIP @refunds = refunds unless refunds == SKIP @funding_debit = funding_debit unless funding_debit == SKIP @funding_credit = funding_credit unless funding_credit == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ String
The batch amount that is an aggregation of all the transactions' amounts in the batch for this brand. It is always represented in the lowest denomination of the related currency.
20 21 22 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 20 def amount @amount end |
#brand ⇒ BrandBatchesBrandBreakdownBrand
Indicates the card brand that this batch summary pertains to.
14 15 16 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 14 def brand @brand end |
#count ⇒ Float
The number of transactions in the batch for this brand.
24 25 26 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 24 def count @count end |
#funding_credit ⇒ FundingCredit1
The amount that is an aggregation of all the transactions' gratuity amounts in the batch for this brand. It is always represented in the lowest denomination of the related currency.
54 55 56 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 54 def funding_credit @funding_credit end |
#funding_debit ⇒ FundingDebit1
The amount that is an aggregation of all the transactions' gratuity amounts in the batch for this brand. It is always represented in the lowest denomination of the related currency.
48 49 50 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 48 def funding_debit @funding_debit end |
#gratuity_amount ⇒ String
The amount that is an aggregation of all the transactions' gratuity amounts in the batch for this brand. It is always represented in the lowest denomination of the related currency.
30 31 32 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 30 def gratuity_amount @gratuity_amount end |
#refunds ⇒ Refunds1
The amount that is an aggregation of all the transactions' gratuity amounts in the batch for this brand. It is always represented in the lowest denomination of the related currency.
42 43 44 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 42 def refunds @refunds end |
#sales ⇒ Sales1
The amount that is an aggregation of all the transactions' gratuity amounts in the batch for this brand. It is always represented in the lowest denomination of the related currency.
36 37 38 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 36 def sales @sales end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 108 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. brand = hash.key?('brand') ? hash['brand'] : SKIP amount = hash.key?('amount') ? hash['amount'] : SKIP count = hash.key?('count') ? hash['count'] : SKIP gratuity_amount = hash.key?('gratuity_amount') ? hash['gratuity_amount'] : SKIP sales = Sales1.from_hash(hash['sales']) if hash['sales'] refunds = Refunds1.from_hash(hash['refunds']) if hash['refunds'] funding_debit = FundingDebit1.from_hash(hash['funding_debit']) if hash['funding_debit'] funding_credit = FundingCredit1.from_hash(hash['funding_credit']) if hash['funding_credit'] # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. BrandBreakdownItem.new(brand: brand, amount: amount, count: count, gratuity_amount: gratuity_amount, sales: sales, refunds: refunds, funding_debit: funding_debit, funding_credit: funding_credit, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 57 def self.names @_hash = {} if @_hash.nil? @_hash['brand'] = 'brand' @_hash['amount'] = 'amount' @_hash['count'] = 'count' @_hash['gratuity_amount'] = 'gratuity_amount' @_hash['sales'] = 'sales' @_hash['refunds'] = 'refunds' @_hash['funding_debit'] = 'funding_debit' @_hash['funding_credit'] = 'funding_credit' @_hash end |
.nullables ⇒ Object
An array for nullable fields
85 86 87 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 85 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 71 def self.optionals %w[ brand amount count gratuity_amount sales refunds funding_debit funding_credit ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
151 152 153 154 155 156 157 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 151 def inspect class_name = self.class.name.split('::').last "<#{class_name} brand: #{@brand.inspect}, amount: #{@amount.inspect}, count:"\ " #{@count.inspect}, gratuity_amount: #{@gratuity_amount.inspect}, sales: #{@sales.inspect},"\ " refunds: #{@refunds.inspect}, funding_debit: #{@funding_debit.inspect}, funding_credit:"\ " #{@funding_credit.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
142 143 144 145 146 147 148 |
# File 'lib/batches/models/brand_breakdown_item.rb', line 142 def to_s class_name = self.class.name.split('::').last "<#{class_name} brand: #{@brand}, amount: #{@amount}, count: #{@count}, gratuity_amount:"\ " #{@gratuity_amount}, sales: #{@sales}, refunds: #{@refunds}, funding_debit:"\ " #{@funding_debit}, funding_credit: #{@funding_credit}, additional_properties:"\ " #{@additional_properties}>" end |