Class: WalmartApIs::StrategyCollection

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

Overview

StrategyCollection Model.

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(repricer_strategy:, strategy_collection_id:, enabled:, assigned_count:, enable_repricer_for_promotion:, restore_seller_price_without_target:, enable_buybox_meet_external:, compare_with3p_offer_only:, strategies:, additional_properties: nil) ⇒ StrategyCollection

Returns a new instance of StrategyCollection.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 74

def initialize(repricer_strategy:, strategy_collection_id:, enabled:,
               assigned_count:, enable_repricer_for_promotion:,
               restore_seller_price_without_target:,
               enable_buybox_meet_external:, compare_with3p_offer_only:,
               strategies:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @repricer_strategy = repricer_strategy
  @strategy_collection_id = strategy_collection_id
  @enabled = enabled
  @assigned_count = assigned_count
  @enable_repricer_for_promotion = enable_repricer_for_promotion
  @restore_seller_price_without_target = restore_seller_price_without_target
  @enable_buybox_meet_external = enable_buybox_meet_external
  @compare_with3p_offer_only = compare_with3p_offer_only
  @strategies = strategies
  @additional_properties = additional_properties
end

Instance Attribute Details

#assigned_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


26
27
28
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 26

def assigned_count
  @assigned_count
end

#compare_with3p_offer_onlyTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def compare_with3p_offer_only
  @compare_with3p_offer_only
end

#enable_buybox_meet_externalTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


38
39
40
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 38

def enable_buybox_meet_external
  @enable_buybox_meet_external
end

#enable_repricer_for_promotionTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 30

def enable_repricer_for_promotion
  @enable_repricer_for_promotion
end

#enabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


22
23
24
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 22

def enabled
  @enabled
end

#repricer_strategyString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 14

def repricer_strategy
  @repricer_strategy
end

#restore_seller_price_without_targetTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


34
35
36
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 34

def restore_seller_price_without_target
  @restore_seller_price_without_target
end

#strategiesArray[Strategy]

TODO: Write general description for this method

Returns:



46
47
48
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 46

def strategies
  @strategies
end

#strategy_collection_idString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 18

def strategy_collection_id
  @strategy_collection_id
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  repricer_strategy =
    hash.key?('repricerStrategy') ? hash['repricerStrategy'] : nil
  strategy_collection_id =
    hash.key?('strategyCollectionId') ? hash['strategyCollectionId'] : nil
  enabled = hash.key?('enabled') ? hash['enabled'] : nil
  assigned_count = hash.key?('assignedCount') ? hash['assignedCount'] : nil
  enable_repricer_for_promotion =
    hash.key?('enableRepricerForPromotion') ? hash['enableRepricerForPromotion'] : nil
  restore_seller_price_without_target =
    hash.key?('restoreSellerPriceWithoutTarget') ? hash['restoreSellerPriceWithoutTarget'] : nil
  enable_buybox_meet_external =
    hash.key?('enableBuyboxMeetExternal') ? hash['enableBuyboxMeetExternal'] : nil
  compare_with3p_offer_only =
    hash.key?('compareWith3pOfferOnly') ? hash['compareWith3pOfferOnly'] : nil
  # Parameter is an array, so we need to iterate through it
  strategies = nil
  unless hash['strategies'].nil?
    strategies = []
    hash['strategies'].each do |structure|
      strategies << (Strategy.from_hash(structure) if structure)
    end
  end

  strategies = nil unless hash.key?('strategies')

  # 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.
  StrategyCollection.new(repricer_strategy: repricer_strategy,
                         strategy_collection_id: strategy_collection_id,
                         enabled: enabled,
                         assigned_count: assigned_count,
                         enable_repricer_for_promotion: enable_repricer_for_promotion,
                         restore_seller_price_without_target: restore_seller_price_without_target,
                         enable_buybox_meet_external: enable_buybox_meet_external,
                         compare_with3p_offer_only: compare_with3p_offer_only,
                         strategies: strategies,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['repricer_strategy'] = 'repricerStrategy'
  @_hash['strategy_collection_id'] = 'strategyCollectionId'
  @_hash['enabled'] = 'enabled'
  @_hash['assigned_count'] = 'assignedCount'
  @_hash['enable_repricer_for_promotion'] = 'enableRepricerForPromotion'
  @_hash['restore_seller_price_without_target'] =
    'restoreSellerPriceWithoutTarget'
  @_hash['enable_buybox_meet_external'] = 'enableBuyboxMeetExternal'
  @_hash['compare_with3p_offer_only'] = 'compareWith3pOfferOnly'
  @_hash['strategies'] = 'strategies'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 70

def self.nullables
  []
end

.optionalsObject

An array for optional fields



65
66
67
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 65

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



157
158
159
160
161
162
163
164
165
166
167
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 157

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} repricer_strategy: #{@repricer_strategy.inspect}, strategy_collection_id:"\
  " #{@strategy_collection_id.inspect}, enabled: #{@enabled.inspect}, assigned_count:"\
  " #{@assigned_count.inspect}, enable_repricer_for_promotion:"\
  " #{@enable_repricer_for_promotion.inspect}, restore_seller_price_without_target:"\
  " #{@restore_seller_price_without_target.inspect}, enable_buybox_meet_external:"\
  " #{@enable_buybox_meet_external.inspect}, compare_with3p_offer_only:"\
  " #{@compare_with3p_offer_only.inspect}, strategies: #{@strategies.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



145
146
147
148
149
150
151
152
153
154
# File 'lib/walmart_ap_is/models/strategy_collection.rb', line 145

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} repricer_strategy: #{@repricer_strategy}, strategy_collection_id:"\
  " #{@strategy_collection_id}, enabled: #{@enabled}, assigned_count: #{@assigned_count},"\
  " enable_repricer_for_promotion: #{@enable_repricer_for_promotion},"\
  " restore_seller_price_without_target: #{@restore_seller_price_without_target},"\
  " enable_buybox_meet_external: #{@enable_buybox_meet_external}, compare_with3p_offer_only:"\
  " #{@compare_with3p_offer_only}, strategies: #{@strategies}, additional_properties:"\
  " #{@additional_properties}>"
end