Class: WalmartApIs::MskuPrepDetail

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

Overview

An MSKU and its related prep 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(msku:, prep_category:, prep_types:, all_owners_constraint: SKIP, label_owner_constraint: SKIP, prep_owner_constraint: SKIP, additional_properties: nil) ⇒ MskuPrepDetail

Returns a new instance of MskuPrepDetail.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 64

def initialize(msku:, prep_category:, prep_types:,
               all_owners_constraint: SKIP, label_owner_constraint: SKIP,
               prep_owner_constraint: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @all_owners_constraint = all_owners_constraint unless all_owners_constraint == SKIP
  @label_owner_constraint = label_owner_constraint unless label_owner_constraint == SKIP
  @msku = msku
  @prep_category = prep_category
  @prep_owner_constraint = prep_owner_constraint unless prep_owner_constraint == SKIP
  @prep_types = prep_types
  @additional_properties = additional_properties
end

Instance Attribute Details

#all_owners_constraintAllOwnersConstraint

A constraint that applies to all owners. If no constraint is specified, defer to any individual owner constraints.

Returns:



15
16
17
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 15

def all_owners_constraint
  @all_owners_constraint
end

#label_owner_constraintOwnerConstraint

A constraint that can apply to an individual owner.

Returns:



19
20
21
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 19

def label_owner_constraint
  @label_owner_constraint
end

#mskuString

The merchant SKU, a merchant-supplied identifier for a specific SKU.

Returns:

  • (String)


23
24
25
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 23

def msku
  @msku
end

#prep_categoryPrepCategory

The preparation category for shipping an item to Walmart's fulfillment network.

Returns:



28
29
30
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 28

def prep_category
  @prep_category
end

#prep_owner_constraintOwnerConstraint

A constraint that can apply to an individual owner.

Returns:



32
33
34
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 32

def prep_owner_constraint
  @prep_owner_constraint
end

#prep_typesArray[PrepType]

A list of preparation types associated with a preparation category.

Returns:



36
37
38
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 36

def prep_types
  @prep_types
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 80

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  msku = hash.key?('msku') ? hash['msku'] : nil
  prep_category = hash.key?('prepCategory') ? hash['prepCategory'] : nil
  prep_types = hash.key?('prepTypes') ? hash['prepTypes'] : nil
  all_owners_constraint =
    hash.key?('allOwnersConstraint') ? hash['allOwnersConstraint'] : SKIP
  label_owner_constraint =
    hash.key?('labelOwnerConstraint') ? hash['labelOwnerConstraint'] : SKIP
  prep_owner_constraint =
    hash.key?('prepOwnerConstraint') ? hash['prepOwnerConstraint'] : SKIP

  # 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.
  MskuPrepDetail.new(msku: msku,
                     prep_category: prep_category,
                     prep_types: prep_types,
                     all_owners_constraint: all_owners_constraint,
                     label_owner_constraint: label_owner_constraint,
                     prep_owner_constraint: prep_owner_constraint,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
48
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['all_owners_constraint'] = 'allOwnersConstraint'
  @_hash['label_owner_constraint'] = 'labelOwnerConstraint'
  @_hash['msku'] = 'msku'
  @_hash['prep_category'] = 'prepCategory'
  @_hash['prep_owner_constraint'] = 'prepOwnerConstraint'
  @_hash['prep_types'] = 'prepTypes'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 60

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 51

def self.optionals
  %w[
    all_owners_constraint
    label_owner_constraint
    prep_owner_constraint
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



121
122
123
124
125
126
127
128
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 121

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} all_owners_constraint: #{@all_owners_constraint.inspect},"\
  " label_owner_constraint: #{@label_owner_constraint.inspect}, msku: #{@msku.inspect},"\
  " prep_category: #{@prep_category.inspect}, prep_owner_constraint:"\
  " #{@prep_owner_constraint.inspect}, prep_types: #{@prep_types.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



112
113
114
115
116
117
118
# File 'lib/walmart_ap_is/models/msku_prep_detail.rb', line 112

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} all_owners_constraint: #{@all_owners_constraint}, label_owner_constraint:"\
  " #{@label_owner_constraint}, msku: #{@msku}, prep_category: #{@prep_category},"\
  " prep_owner_constraint: #{@prep_owner_constraint}, prep_types: #{@prep_types},"\
  " additional_properties: #{@additional_properties}>"
end