Class: NewStoreApi::FulfillmentAssignment
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::FulfillmentAssignment
- Defined in:
- lib/new_store_api/models/fulfillment_assignment.rb
Overview
FulfillmentAssignment Model.
Instance Attribute Summary collapse
-
#currency ⇒ CurrencyEnum
TODO: Write general description for this method.
-
#line_items ⇒ Array[LineItem]
Which products can be fulfilled from this location.
-
#location_id ⇒ String
The Location ID that is going to fulfill the items.
-
#price ⇒ Float
The Location ID that is going to fulfill the items.
-
#tax_code ⇒ String
The Location ID that is going to fulfill the items.
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(currency = nil, line_items = nil, location_id = nil, price = nil, tax_code = SKIP) ⇒ FulfillmentAssignment
constructor
A new instance of FulfillmentAssignment.
-
#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(currency = nil, line_items = nil, location_id = nil, price = nil, tax_code = SKIP) ⇒ FulfillmentAssignment
Returns a new instance of FulfillmentAssignment.
57 58 59 60 61 62 63 64 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 57 def initialize(currency = nil, line_items = nil, location_id = nil, price = nil, tax_code = SKIP) @currency = currency @line_items = line_items @location_id = location_id @price = price @tax_code = tax_code unless tax_code == SKIP end |
Instance Attribute Details
#currency ⇒ CurrencyEnum
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 14 def currency @currency end |
#line_items ⇒ Array[LineItem]
Which products can be fulfilled from this location.
18 19 20 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 18 def line_items @line_items end |
#location_id ⇒ String
The Location ID that is going to fulfill the items
22 23 24 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 22 def location_id @location_id end |
#price ⇒ Float
The Location ID that is going to fulfill the items
26 27 28 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 26 def price @price end |
#tax_code ⇒ String
The Location ID that is going to fulfill the items
30 31 32 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 30 def tax_code @tax_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 67 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. currency = hash.key?('currency') ? hash['currency'] : nil # Parameter is an array, so we need to iterate through it line_items = nil unless hash['line_items'].nil? line_items = [] hash['line_items'].each do |structure| line_items << (LineItem.from_hash(structure) if structure) end end line_items = nil unless hash.key?('line_items') location_id = hash.key?('location_id') ? hash['location_id'] : nil price = hash.key?('price') ? hash['price'] : nil tax_code = hash.key?('tax_code') ? hash['tax_code'] : SKIP # Create object from extracted values. FulfillmentAssignment.new(currency, line_items, location_id, price, tax_code) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['currency'] = 'currency' @_hash['line_items'] = 'line_items' @_hash['location_id'] = 'location_id' @_hash['price'] = 'price' @_hash['tax_code'] = 'tax_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 54 55 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 51 def self.nullables %w[ tax_code ] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 44 def self.optionals %w[ tax_code ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
102 103 104 105 106 107 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 102 def inspect class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency.inspect}, line_items: #{@line_items.inspect},"\ " location_id: #{@location_id.inspect}, price: #{@price.inspect}, tax_code:"\ " #{@tax_code.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
95 96 97 98 99 |
# File 'lib/new_store_api/models/fulfillment_assignment.rb', line 95 def to_s class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency}, line_items: #{@line_items}, location_id:"\ " #{@location_id}, price: #{@price}, tax_code: #{@tax_code}>" end |