Class: NewStoreApi::FulfillmentRequest1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/fulfillment_request1.rb

Overview

The fulfillment request.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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, fulfillment_node_id = nil, fulfillment_request_id = nil, items = nil, service_level = nil, status = nil) ⇒ FulfillmentRequest1

Returns a new instance of FulfillmentRequest1.



65
66
67
68
69
70
71
72
73
74
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 65

def initialize(created_at = nil, fulfillment_node_id = nil,
               fulfillment_request_id = nil, items = nil,
               service_level = nil, status = nil)
  @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

Instance Attribute Details

#created_atDateTime

Date and time when fulfillment request was created.

Returns:

  • (DateTime)


15
16
17
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 15

def created_at
  @created_at
end

#fulfillment_node_idString

Fulfillment node where fulfillment request was routed to.

Returns:

  • (String)


19
20
21
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 19

def fulfillment_node_id
  @fulfillment_node_id
end

#fulfillment_request_idString

The identifier of the fulfillment request.

Returns:

  • (String)


23
24
25
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 23

def fulfillment_request_id
  @fulfillment_request_id
end

#itemsArray[Item8]

The identifier of the fulfillment request.

Returns:



27
28
29
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 27

def items
  @items
end

#service_levelString

Service level fulfillment request was routed with.

Returns:

  • (String)


31
32
33
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 31

def service_level
  @service_level
end

#statusStatus11Enum

Current status of fulfillment request: dispatched - fulfillment request was sent to sent to store/DC services, but wasn't acknowledged yet; acknowledged - fulfillment request was acknowledged by store/DC service and will be send to store/DC for fulfillment; partially_completed - some items of fulfillment request were already processed (cancelled, rejected, shipped) but not all of them; completed - all items of fulfillment request were processed (cancelled, rejected, shipped).

Returns:



41
42
43
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 41

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
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 77

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
  fulfillment_node_id =
    hash.key?('fulfillment_node_id') ? hash['fulfillment_node_id'] : nil
  fulfillment_request_id =
    hash.key?('fulfillment_request_id') ? hash['fulfillment_request_id'] : nil
  # Parameter is an array, so we need to iterate through it
  items = nil
  unless hash['items'].nil?
    items = []
    hash['items'].each do |structure|
      items << (Item8.from_hash(structure) if structure)
    end
  end

  items = nil unless hash.key?('items')
  service_level = hash.key?('service_level') ? hash['service_level'] : nil
  status = hash.key?('status') ? hash['status'] : nil

  # Create object from extracted values.
  FulfillmentRequest1.new(created_at,
                          fulfillment_node_id,
                          fulfillment_request_id,
                          items,
                          service_level,
                          status)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
53
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 44

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

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 56

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



123
124
125
126
127
128
129
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 123

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_atObject



110
111
112
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 110

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_sObject

Provides a human-readable string representation of the object.



115
116
117
118
119
120
# File 'lib/new_store_api/models/fulfillment_request1.rb', line 115

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