Class: NewStoreApi::FulfillmentRequestLineItem

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

Overview

Fulfillment Request Line Item Details

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(item_id = nil, status = nil, carrier = SKIP, carrier_service_level = SKIP, product_id = SKIP, rejection_reason = SKIP, tracking_code = SKIP, tracking_url = SKIP) ⇒ FulfillmentRequestLineItem

Returns a new instance of FulfillmentRequestLineItem.



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 80

def initialize(item_id = nil, status = nil, carrier = SKIP,
               carrier_service_level = SKIP, product_id = SKIP,
               rejection_reason = SKIP, tracking_code = SKIP,
               tracking_url = SKIP)
  @carrier = carrier unless carrier == SKIP
  @carrier_service_level = carrier_service_level unless carrier_service_level == SKIP
  @item_id = item_id
  @product_id = product_id unless product_id == SKIP
  @rejection_reason = rejection_reason unless rejection_reason == SKIP
  @status = status
  @tracking_code = tracking_code unless tracking_code == SKIP
  @tracking_url = tracking_url unless tracking_url == SKIP
end

Instance Attribute Details

#carrierString

Carrier for a shipped item.

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 14

def carrier
  @carrier
end

#carrier_service_levelString

Carrier service level for a shipped item.

Returns:

  • (String)


18
19
20
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 18

def carrier_service_level
  @carrier_service_level
end

#item_idUUID | String

Unique identifier of the line item.

Returns:

  • (UUID | String)


22
23
24
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 22

def item_id
  @item_id
end

#product_idString

Unique identifier of the line item.

Returns:

  • (String)


26
27
28
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 26

def product_id
  @product_id
end

#rejection_reasonString

Rejection reason of a rejected fulfillment request item.

Returns:

  • (String)


30
31
32
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 30

def rejection_reason
  @rejection_reason
end

#statusString

Status of an individual fulfillment request item.

Returns:

  • (String)


34
35
36
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 34

def status
  @status
end

#tracking_codeString

Tracking code for a shipped item.

Returns:

  • (String)


38
39
40
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 38

def tracking_code
  @tracking_code
end

#tracking_urlString

Tracking url for a shipped item.

Returns:

  • (String)


42
43
44
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 42

def tracking_url
  @tracking_url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  item_id = hash.key?('item_id') ? hash['item_id'] : nil
  status = hash.key?('status') ? hash['status'] : nil
  carrier = hash.key?('carrier') ? hash['carrier'] : SKIP
  carrier_service_level =
    hash.key?('carrier_service_level') ? hash['carrier_service_level'] : SKIP
  product_id = hash.key?('product_id') ? hash['product_id'] : SKIP
  rejection_reason =
    hash.key?('rejection_reason') ? hash['rejection_reason'] : SKIP
  tracking_code = hash.key?('tracking_code') ? hash['tracking_code'] : SKIP
  tracking_url = hash.key?('tracking_url') ? hash['tracking_url'] : SKIP

  # Create object from extracted values.
  FulfillmentRequestLineItem.new(item_id,
                                 status,
                                 carrier,
                                 carrier_service_level,
                                 product_id,
                                 rejection_reason,
                                 tracking_code,
                                 tracking_url)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['carrier'] = 'carrier'
  @_hash['carrier_service_level'] = 'carrier_service_level'
  @_hash['item_id'] = 'item_id'
  @_hash['product_id'] = 'product_id'
  @_hash['rejection_reason'] = 'rejection_reason'
  @_hash['status'] = 'status'
  @_hash['tracking_code'] = 'tracking_code'
  @_hash['tracking_url'] = 'tracking_url'
  @_hash
end

.nullablesObject

An array for nullable fields



71
72
73
74
75
76
77
78
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 71

def self.nullables
  %w[
    carrier
    carrier_service_level
    tracking_code
    tracking_url
  ]
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 59

def self.optionals
  %w[
    carrier
    carrier_service_level
    product_id
    rejection_reason
    tracking_code
    tracking_url
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



130
131
132
133
134
135
136
137
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 130

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} carrier: #{@carrier.inspect}, carrier_service_level:"\
  " #{@carrier_service_level.inspect}, item_id: #{@item_id.inspect}, product_id:"\
  " #{@product_id.inspect}, rejection_reason: #{@rejection_reason.inspect}, status:"\
  " #{@status.inspect}, tracking_code: #{@tracking_code.inspect}, tracking_url:"\
  " #{@tracking_url.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



122
123
124
125
126
127
# File 'lib/new_store_api/models/fulfillment_request_line_item.rb', line 122

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} carrier: #{@carrier}, carrier_service_level: #{@carrier_service_level},"\
  " item_id: #{@item_id}, product_id: #{@product_id}, rejection_reason: #{@rejection_reason},"\
  " status: #{@status}, tracking_code: #{@tracking_code}, tracking_url: #{@tracking_url}>"
end