Class: WalmartApIs::InboundPlanSummary

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/inbound_plan_summary.rb

Overview

A light-weight inbound plan.

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:, inbound_plan_id:, last_updated_at:, marketplace_ids:, name:, source_address:, status:, additional_properties: nil) ⇒ InboundPlanSummary

Returns a new instance of InboundPlanSummary.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 67

def initialize(created_at:, inbound_plan_id:, last_updated_at:,
               marketplace_ids:, name:, source_address:, status:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @created_at = created_at
  @inbound_plan_id = inbound_plan_id
  @last_updated_at = last_updated_at
  @marketplace_ids = marketplace_ids
  @name = name
  @source_address = source_address
  @status = status
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_atDateTime

The time at which the inbound plan was created. In ISO 8601 datetime format with pattern yyyy-MM-ddTHH:mm:ssZ.

Returns:

  • (DateTime)


16
17
18
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 16

def created_at
  @created_at
end

#inbound_plan_idString

Identifier of an inbound plan.

Returns:

  • (String)


20
21
22
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 20

def inbound_plan_id
  @inbound_plan_id
end

#last_updated_atDateTime

The time at which the inbound plan was last updated. In ISO 8601 datetime format with pattern yyyy-MM-ddTHH:mm:ssZ.

Returns:

  • (DateTime)


25
26
27
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 25

def last_updated_at
  @last_updated_at
end

#marketplace_idsArray[String]

A list of Walmart marketplace IDs associated with this inbound plan.

Returns:

  • (Array[String])


29
30
31
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 29

def marketplace_ids
  @marketplace_ids
end

#nameString

Human-readable name of the inbound plan.

Returns:

  • (String)


33
34
35
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 33

def name
  @name
end

#source_addressAddress

Specific details to identify a place.

Returns:



37
38
39
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 37

def source_address
  @source_address
end

#statusString

The current status of the inbound plan. Possible values: ACTIVE, VOIDED, SHIPPED, ERRORED.

Returns:

  • (String)


42
43
44
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 42

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
111
112
113
114
115
116
117
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  created_at = if hash.key?('createdAt')
                 (DateTimeHelper.from_rfc3339(hash['createdAt']) if hash['createdAt'])
               end
  inbound_plan_id = hash.key?('inboundPlanId') ? hash['inboundPlanId'] : nil
  last_updated_at = if hash.key?('lastUpdatedAt')
                      (DateTimeHelper.from_rfc3339(hash['lastUpdatedAt']) if hash['lastUpdatedAt'])
                    end
  marketplace_ids =
    hash.key?('marketplaceIds') ? hash['marketplaceIds'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  source_address = Address.from_hash(hash['sourceAddress']) if hash['sourceAddress']
  status = hash.key?('status') ? hash['status'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  InboundPlanSummary.new(created_at: created_at,
                         inbound_plan_id: inbound_plan_id,
                         last_updated_at: last_updated_at,
                         marketplace_ids: marketplace_ids,
                         name: name,
                         source_address: source_address,
                         status: status,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['created_at'] = 'createdAt'
  @_hash['inbound_plan_id'] = 'inboundPlanId'
  @_hash['last_updated_at'] = 'lastUpdatedAt'
  @_hash['marketplace_ids'] = 'marketplaceIds'
  @_hash['name'] = 'name'
  @_hash['source_address'] = 'sourceAddress'
  @_hash['status'] = 'status'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



58
59
60
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 58

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



137
138
139
140
141
142
143
144
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 137

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} created_at: #{@created_at.inspect}, inbound_plan_id:"\
  " #{@inbound_plan_id.inspect}, last_updated_at: #{@last_updated_at.inspect},"\
  " marketplace_ids: #{@marketplace_ids.inspect}, name: #{@name.inspect}, source_address:"\
  " #{@source_address.inspect}, status: #{@status.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_created_atObject



119
120
121
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 119

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_last_updated_atObject



123
124
125
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 123

def to_custom_last_updated_at
  DateTimeHelper.to_rfc3339(last_updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



128
129
130
131
132
133
134
# File 'lib/walmart_ap_is/models/inbound_plan_summary.rb', line 128

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} created_at: #{@created_at}, inbound_plan_id: #{@inbound_plan_id},"\
  " last_updated_at: #{@last_updated_at}, marketplace_ids: #{@marketplace_ids}, name:"\
  " #{@name}, source_address: #{@source_address}, status: #{@status}, additional_properties:"\
  " #{@additional_properties}>"
end