Class: NewStoreApi::FulfillmentRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::FulfillmentRequest
- Defined in:
- lib/new_store_api/models/fulfillment_request.rb
Overview
The fulfillment request.
Instance Attribute Summary collapse
-
#created_at ⇒ DateTime
Date and time when fulfillment request was created.
-
#fulfillment_node_id ⇒ String
Fulfillment node where fulfillment request was routed to.
-
#fulfillment_request_id ⇒ UUID | String
The identifier of the fulfillment request.
-
#items ⇒ Array[FulfillmentRequestLineItem]
The identifier of the fulfillment request.
-
#service_level ⇒ String
Service level fulfillment request was routed with.
-
#status ⇒ String
Service level fulfillment request was routed with.
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(items = nil, created_at = SKIP, fulfillment_node_id = SKIP, fulfillment_request_id = SKIP, service_level = SKIP, status = SKIP) ⇒ FulfillmentRequest
constructor
A new instance of FulfillmentRequest.
-
#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(items = nil, created_at = SKIP, fulfillment_node_id = SKIP, fulfillment_request_id = SKIP, service_level = SKIP, status = SKIP) ⇒ FulfillmentRequest
Returns a new instance of FulfillmentRequest.
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 65 def initialize(items = nil, created_at = SKIP, fulfillment_node_id = SKIP, fulfillment_request_id = SKIP, service_level = SKIP, status = SKIP) @created_at = created_at unless created_at == SKIP @fulfillment_node_id = fulfillment_node_id unless fulfillment_node_id == SKIP @fulfillment_request_id = fulfillment_request_id unless fulfillment_request_id == SKIP @items = items @service_level = service_level unless service_level == SKIP @status = status unless status == SKIP end |
Instance Attribute Details
#created_at ⇒ DateTime
Date and time when fulfillment request was created.
15 16 17 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 15 def created_at @created_at end |
#fulfillment_node_id ⇒ String
Fulfillment node where fulfillment request was routed to.
19 20 21 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 19 def fulfillment_node_id @fulfillment_node_id end |
#fulfillment_request_id ⇒ UUID | String
The identifier of the fulfillment request.
23 24 25 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 23 def fulfillment_request_id @fulfillment_request_id end |
#items ⇒ Array[FulfillmentRequestLineItem]
The identifier of the fulfillment request.
27 28 29 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 27 def items @items end |
#service_level ⇒ String
Service level fulfillment request was routed with.
31 32 33 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 31 def service_level @service_level end |
#status ⇒ String
Service level fulfillment request was routed with.
35 36 37 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 35 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 77 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it items = nil unless hash['items'].nil? items = [] hash['items'].each do |structure| items << (FulfillmentRequestLineItem.from_hash(structure) if structure) end end items = nil unless hash.key?('items') created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) else SKIP end fulfillment_node_id = hash.key?('fulfillment_node_id') ? hash['fulfillment_node_id'] : SKIP fulfillment_request_id = hash.key?('fulfillment_request_id') ? hash['fulfillment_request_id'] : SKIP service_level = hash.key?('service_level') ? hash['service_level'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP # Create object from extracted values. FulfillmentRequest.new(items, created_at, fulfillment_node_id, fulfillment_request_id, service_level, status) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['created_at'] = 'created_at' @_hash['fulfillment_node_id'] = 'fulfillment_node_id' @_hash['fulfillment_request_id'] = 'fulfillment_request_id' @_hash['items'] = 'items' @_hash['service_level'] = 'service_level' @_hash['status'] = 'status' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 58 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 50 def self.optionals %w[ created_at fulfillment_node_id fulfillment_request_id service_level status ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
125 126 127 128 129 130 131 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 125 def inspect class_name = self.class.name.split('::').last "<#{class_name} created_at: #{@created_at.inspect}, fulfillment_node_id:"\ " #{@fulfillment_node_id.inspect}, fulfillment_request_id:"\ " #{@fulfillment_request_id.inspect}, items: #{@items.inspect}, service_level:"\ " #{@service_level.inspect}, status: #{@status.inspect}>" end |
#to_custom_created_at ⇒ Object
112 113 114 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 112 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
117 118 119 120 121 122 |
# File 'lib/new_store_api/models/fulfillment_request.rb', line 117 def to_s class_name = self.class.name.split('::').last "<#{class_name} created_at: #{@created_at}, fulfillment_node_id: #{@fulfillment_node_id},"\ " fulfillment_request_id: #{@fulfillment_request_id}, items: #{@items}, service_level:"\ " #{@service_level}, status: #{@status}>" end |