Class: NewStoreApi::FulfillmentNodeAssignment

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

Overview

A fulfillment node assigned to fulfill products in an order at a certain service level. And products which can be routed with this service level

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(fulfillment_node_id = nil, line_items = nil, service_level_identifier = nil, type = SKIP) ⇒ FulfillmentNodeAssignment

Returns a new instance of FulfillmentNodeAssignment.



52
53
54
55
56
57
58
# File 'lib/new_store_api/models/fulfillment_node_assignment.rb', line 52

def initialize(fulfillment_node_id = nil, line_items = nil,
               service_level_identifier = nil, type = SKIP)
  @fulfillment_node_id = fulfillment_node_id
  @line_items = line_items
  @service_level_identifier = service_level_identifier
  @type = type unless type == SKIP
end

Instance Attribute Details

#fulfillment_node_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def fulfillment_node_id
  @fulfillment_node_id
end

#line_itemsArray[LineItem3]

Line items in this fulfillment node assignment

Returns:



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

def line_items
  @line_items
end

#service_level_identifierString

Line items in this fulfillment node assignment

Returns:

  • (String)


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

def service_level_identifier
  @service_level_identifier
end

#typeType2Enum

Shows if this FF node assignment available right now (regular), or can be fulfilled in the future (pre-order)

Returns:



28
29
30
# File 'lib/new_store_api/models/fulfillment_node_assignment.rb', line 28

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/new_store_api/models/fulfillment_node_assignment.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  fulfillment_node_id =
    hash.key?('fulfillment_node_id') ? hash['fulfillment_node_id'] : nil
  # Parameter is an array, so we need to iterate through it
  line_items = nil
  unless hash['line_items'].nil?
    line_items = []
    hash['line_items'].each do |structure|
      line_items << (LineItem3.from_hash(structure) if structure)
    end
  end

  line_items = nil unless hash.key?('line_items')
  service_level_identifier =
    hash.key?('service_level_identifier') ? hash['service_level_identifier'] : nil
  type = hash.key?('type') ? hash['type'] : SKIP

  # Create object from extracted values.
  FulfillmentNodeAssignment.new(fulfillment_node_id,
                                line_items,
                                service_level_identifier,
                                type)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/new_store_api/models/fulfillment_node_assignment.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['fulfillment_node_id'] = 'fulfillment_node_id'
  @_hash['line_items'] = 'line_items'
  @_hash['service_level_identifier'] = 'service_level_identifier'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/new_store_api/models/fulfillment_node_assignment.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
44
45
# File 'lib/new_store_api/models/fulfillment_node_assignment.rb', line 41

def self.optionals
  %w[
    type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



96
97
98
99
100
101
# File 'lib/new_store_api/models/fulfillment_node_assignment.rb', line 96

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} fulfillment_node_id: #{@fulfillment_node_id.inspect}, line_items:"\
  " #{@line_items.inspect}, service_level_identifier: #{@service_level_identifier.inspect},"\
  " type: #{@type.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



89
90
91
92
93
# File 'lib/new_store_api/models/fulfillment_node_assignment.rb', line 89

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} fulfillment_node_id: #{@fulfillment_node_id}, line_items: #{@line_items},"\
  " service_level_identifier: #{@service_level_identifier}, type: #{@type}>"
end