Class: NewStoreApi::ResponseShippingOption
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::ResponseShippingOption
- Defined in:
- lib/new_store_api/models/response_shipping_option.rb
Overview
ResponseShippingOption Model.
Instance Attribute Summary collapse
-
#audit_id ⇒ String
TODO: Write general description for this method.
-
#created_at ⇒ DateTime
TODO: Write general description for this method.
-
#currency ⇒ CurrencyEnum
TODO: Write general description for this method.
-
#delivery_window ⇒ ResponseDeliveryWindow
TODO: Write general description for this method.
-
#option_id ⇒ String
TODO: Write general description for this method.
-
#price ⇒ Float
TODO: Write general description for this method.
-
#provider_rate ⇒ String
TODO: Write general description for this method.
-
#service_level ⇒ String
TODO: Write general description for this method.
-
#shipping_carrier ⇒ String
TODO: Write general description for this method.
-
#tax_code ⇒ 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.
Instance Method Summary collapse
-
#initialize(created_at = nil, currency = nil, delivery_window = nil, option_id = nil, price = nil, provider_rate = nil, service_level = nil, shipping_carrier = nil, tax_code = nil, audit_id = SKIP) ⇒ ResponseShippingOption
constructor
A new instance of ResponseShippingOption.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
-
#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(created_at = nil, currency = nil, delivery_window = nil, option_id = nil, price = nil, provider_rate = nil, service_level = nil, shipping_carrier = nil, tax_code = nil, audit_id = SKIP) ⇒ ResponseShippingOption
Returns a new instance of ResponseShippingOption.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 83 def initialize(created_at = nil, currency = nil, delivery_window = nil, option_id = nil, price = nil, provider_rate = nil, service_level = nil, shipping_carrier = nil, tax_code = nil, audit_id = SKIP) @audit_id = audit_id unless audit_id == SKIP @created_at = created_at @currency = currency @delivery_window = delivery_window @option_id = option_id @price = price @provider_rate = provider_rate @service_level = service_level @shipping_carrier = shipping_carrier @tax_code = tax_code end |
Instance Attribute Details
#audit_id ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 15 def audit_id @audit_id end |
#created_at ⇒ DateTime
TODO: Write general description for this method
19 20 21 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 19 def created_at @created_at end |
#currency ⇒ CurrencyEnum
TODO: Write general description for this method
23 24 25 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 23 def currency @currency end |
#delivery_window ⇒ ResponseDeliveryWindow
TODO: Write general description for this method
27 28 29 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 27 def delivery_window @delivery_window end |
#option_id ⇒ String
TODO: Write general description for this method
31 32 33 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 31 def option_id @option_id end |
#price ⇒ Float
TODO: Write general description for this method
35 36 37 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 35 def price @price end |
#provider_rate ⇒ String
TODO: Write general description for this method
39 40 41 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 39 def provider_rate @provider_rate end |
#service_level ⇒ String
TODO: Write general description for this method
43 44 45 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 43 def service_level @service_level end |
#shipping_carrier ⇒ String
TODO: Write general description for this method
47 48 49 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 47 def shipping_carrier @shipping_carrier end |
#tax_code ⇒ String
TODO: Write general description for this method
51 52 53 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 51 def tax_code @tax_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 100 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end currency = hash.key?('currency') ? hash['currency'] : nil delivery_window = ResponseDeliveryWindow.from_hash(hash['delivery_window']) if hash['delivery_window'] option_id = hash.key?('option_id') ? hash['option_id'] : nil price = hash.key?('price') ? hash['price'] : nil provider_rate = hash.key?('provider_rate') ? hash['provider_rate'] : nil service_level = hash.key?('service_level') ? hash['service_level'] : nil shipping_carrier = hash.key?('shipping_carrier') ? hash['shipping_carrier'] : nil tax_code = hash.key?('tax_code') ? hash['tax_code'] : nil audit_id = hash.key?('audit_id') ? hash['audit_id'] : SKIP # Create object from extracted values. ResponseShippingOption.new(created_at, currency, delivery_window, option_id, price, provider_rate, service_level, shipping_carrier, tax_code, audit_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 54 def self.names @_hash = {} if @_hash.nil? @_hash['audit_id'] = 'audit_id' @_hash['created_at'] = 'created_at' @_hash['currency'] = 'currency' @_hash['delivery_window'] = 'delivery_window' @_hash['option_id'] = 'option_id' @_hash['price'] = 'price' @_hash['provider_rate'] = 'provider_rate' @_hash['service_level'] = 'service_level' @_hash['shipping_carrier'] = 'shipping_carrier' @_hash['tax_code'] = 'tax_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
77 78 79 80 81 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 77 def self.nullables %w[ audit_id ] end |
.optionals ⇒ Object
An array for optional fields
70 71 72 73 74 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 70 def self.optionals %w[ audit_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
146 147 148 149 150 151 152 153 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 146 def inspect class_name = self.class.name.split('::').last "<#{class_name} audit_id: #{@audit_id.inspect}, created_at: #{@created_at.inspect},"\ " currency: #{@currency.inspect}, delivery_window: #{@delivery_window.inspect}, option_id:"\ " #{@option_id.inspect}, price: #{@price.inspect}, provider_rate: #{@provider_rate.inspect},"\ " service_level: #{@service_level.inspect}, shipping_carrier: #{@shipping_carrier.inspect},"\ " tax_code: #{@tax_code.inspect}>" end |
#to_custom_created_at ⇒ Object
132 133 134 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 132 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
137 138 139 140 141 142 143 |
# File 'lib/new_store_api/models/response_shipping_option.rb', line 137 def to_s class_name = self.class.name.split('::').last "<#{class_name} audit_id: #{@audit_id}, created_at: #{@created_at}, currency: #{@currency},"\ " delivery_window: #{@delivery_window}, option_id: #{@option_id}, price: #{@price},"\ " provider_rate: #{@provider_rate}, service_level: #{@service_level}, shipping_carrier:"\ " #{@shipping_carrier}, tax_code: #{@tax_code}>" end |