Class: NewStoreApi::ShipmentLimitsRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::ShipmentLimitsRequest
- Defined in:
- lib/new_store_api/models/shipment_limits_request.rb
Overview
Limit shipment rules for given currency x service level
Instance Attribute Summary collapse
-
#currency ⇒ String
Currency alpha code in ISO 4217 format.
-
#limit_exceeded_when ⇒ Array[LimitExceededWhen]
Currency alpha code in ISO 4217 format.
-
#service_level ⇒ String
Shipping service level.
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, limit_exceeded_when = nil, service_level = nil) ⇒ ShipmentLimitsRequest
constructor
A new instance of ShipmentLimitsRequest.
-
#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, limit_exceeded_when = nil, service_level = nil) ⇒ ShipmentLimitsRequest
Returns a new instance of ShipmentLimitsRequest.
43 44 45 46 47 48 |
# File 'lib/new_store_api/models/shipment_limits_request.rb', line 43 def initialize(currency = nil, limit_exceeded_when = nil, service_level = nil) @currency = currency @limit_exceeded_when = limit_exceeded_when @service_level = service_level end |
Instance Attribute Details
#currency ⇒ String
Currency alpha code in ISO 4217 format. Per example USD, EUR or JPY
14 15 16 |
# File 'lib/new_store_api/models/shipment_limits_request.rb', line 14 def currency @currency end |
#limit_exceeded_when ⇒ Array[LimitExceededWhen]
Currency alpha code in ISO 4217 format. Per example USD, EUR or JPY
18 19 20 |
# File 'lib/new_store_api/models/shipment_limits_request.rb', line 18 def limit_exceeded_when @limit_exceeded_when end |
#service_level ⇒ String
Shipping service level
22 23 24 |
# File 'lib/new_store_api/models/shipment_limits_request.rb', line 22 def service_level @service_level end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/new_store_api/models/shipment_limits_request.rb', line 51 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 limit_exceeded_when = nil unless hash['limit_exceeded_when'].nil? limit_exceeded_when = [] hash['limit_exceeded_when'].each do |structure| limit_exceeded_when << (LimitExceededWhen.from_hash(structure) if structure) end end limit_exceeded_when = nil unless hash.key?('limit_exceeded_when') service_level = hash.key?('service_level') ? hash['service_level'] : nil # Create object from extracted values. ShipmentLimitsRequest.new(currency, limit_exceeded_when, service_level) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/new_store_api/models/shipment_limits_request.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['currency'] = 'currency' @_hash['limit_exceeded_when'] = 'limit_exceeded_when' @_hash['service_level'] = 'service_level' @_hash end |
.nullables ⇒ Object
An array for nullable fields
39 40 41 |
# File 'lib/new_store_api/models/shipment_limits_request.rb', line 39 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 |
# File 'lib/new_store_api/models/shipment_limits_request.rb', line 34 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
82 83 84 85 86 |
# File 'lib/new_store_api/models/shipment_limits_request.rb', line 82 def inspect class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency.inspect}, limit_exceeded_when:"\ " #{@limit_exceeded_when.inspect}, service_level: #{@service_level.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
75 76 77 78 79 |
# File 'lib/new_store_api/models/shipment_limits_request.rb', line 75 def to_s class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency}, limit_exceeded_when: #{@limit_exceeded_when},"\ " service_level: #{@service_level}>" end |