Class: NewStoreApi::FulfillmentRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/fulfillment_request.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(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_atDateTime

Date and time when fulfillment request was created.

Returns:

  • (DateTime)


15
16
17
# File 'lib/new_store_api/models/fulfillment_request.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_request.rb', line 19

def fulfillment_node_id
  @fulfillment_node_id
end

#fulfillment_request_idUUID | String

The identifier of the fulfillment request.

Returns:

  • (UUID | String)


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

def fulfillment_request_id
  @fulfillment_request_id
end

#itemsArray[FulfillmentRequestLineItem]

The identifier of the fulfillment request.

Returns:



27
28
29
# File 'lib/new_store_api/models/fulfillment_request.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_request.rb', line 31

def service_level
  @service_level
end

#statusString

Service level fulfillment request was routed with.

Returns:

  • (String)


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

.namesObject

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

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

#inspectObject

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_atObject



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_sObject

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