Class: Repull::ListingPricingStrategyInput

Inherits:
ApiModelBase show all
Defined in:
lib/repull/models/listing_pricing_strategy_input.rb

Overview

Same shape as ‘ListingPricingStrategy` minus the read-only fields. Send only fields you want to change.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ ListingPricingStrategyInput

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 107

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::ListingPricingStrategyInput` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::ListingPricingStrategyInput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'mode')
    self.mode = attributes[:'mode']
  end

  if attributes.key?(:'min_price')
    self.min_price = attributes[:'min_price']
  end

  if attributes.key?(:'max_price')
    self.max_price = attributes[:'max_price']
  end

  if attributes.key?(:'max_daily_change_pct')
    self.max_daily_change_pct = attributes[:'max_daily_change_pct']
  end

  if attributes.key?(:'weekend_markup_pct')
    self.weekend_markup_pct = attributes[:'weekend_markup_pct']
  end

  if attributes.key?(:'day_of_week_multipliers')
    if (value = attributes[:'day_of_week_multipliers']).is_a?(Hash)
      self.day_of_week_multipliers = value
    end
  end

  if attributes.key?(:'target_occupancy_pct')
    self.target_occupancy_pct = attributes[:'target_occupancy_pct']
  end

  if attributes.key?(:'target_monthly_revenue')
    self.target_monthly_revenue = attributes[:'target_monthly_revenue']
  end

  if attributes.key?(:'owner_min_monthly_payout')
    self.owner_min_monthly_payout = attributes[:'owner_min_monthly_payout']
  end

  if attributes.key?(:'comp_position_target')
    self.comp_position_target = attributes[:'comp_position_target']
  end

  if attributes.key?(:'comp_adjust_pct')
    self.comp_adjust_pct = attributes[:'comp_adjust_pct']
  end

  if attributes.key?(:'event_boost_enabled')
    self.event_boost_enabled = attributes[:'event_boost_enabled']
  end

  if attributes.key?(:'event_boost_max_pct')
    self.event_boost_max_pct = attributes[:'event_boost_max_pct']
  end
end

Instance Attribute Details

#comp_adjust_pctObject

Returns the value of attribute comp_adjust_pct.



39
40
41
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 39

def comp_adjust_pct
  @comp_adjust_pct
end

#comp_position_targetObject

Returns the value of attribute comp_position_target.



37
38
39
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 37

def comp_position_target
  @comp_position_target
end

#day_of_week_multipliersObject

Returns the value of attribute day_of_week_multipliers.



29
30
31
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 29

def day_of_week_multipliers
  @day_of_week_multipliers
end

#event_boost_enabledObject

Returns the value of attribute event_boost_enabled.



41
42
43
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 41

def event_boost_enabled
  @event_boost_enabled
end

#event_boost_max_pctObject

Returns the value of attribute event_boost_max_pct.



43
44
45
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 43

def event_boost_max_pct
  @event_boost_max_pct
end

#max_daily_change_pctObject

Returns the value of attribute max_daily_change_pct.



25
26
27
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 25

def max_daily_change_pct
  @max_daily_change_pct
end

#max_priceObject

Returns the value of attribute max_price.



23
24
25
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 23

def max_price
  @max_price
end

#min_priceObject

Returns the value of attribute min_price.



21
22
23
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 21

def min_price
  @min_price
end

#modeObject

Returns the value of attribute mode.



19
20
21
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 19

def mode
  @mode
end

#owner_min_monthly_payoutObject

Returns the value of attribute owner_min_monthly_payout.



35
36
37
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 35

def owner_min_monthly_payout
  @owner_min_monthly_payout
end

#target_monthly_revenueObject

Returns the value of attribute target_monthly_revenue.



33
34
35
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 33

def target_monthly_revenue
  @target_monthly_revenue
end

#target_occupancy_pctObject

Returns the value of attribute target_occupancy_pct.



31
32
33
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 31

def target_occupancy_pct
  @target_occupancy_pct
end

#weekend_markup_pctObject

Returns the value of attribute weekend_markup_pct.



27
28
29
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 27

def weekend_markup_pct
  @weekend_markup_pct
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



65
66
67
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 65

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



70
71
72
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 70

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 46

def self.attribute_map
  {
    :'mode' => :'mode',
    :'min_price' => :'minPrice',
    :'max_price' => :'maxPrice',
    :'max_daily_change_pct' => :'maxDailyChangePct',
    :'weekend_markup_pct' => :'weekendMarkupPct',
    :'day_of_week_multipliers' => :'dayOfWeekMultipliers',
    :'target_occupancy_pct' => :'targetOccupancyPct',
    :'target_monthly_revenue' => :'targetMonthlyRevenue',
    :'owner_min_monthly_payout' => :'ownerMinMonthlyPayout',
    :'comp_position_target' => :'compPositionTarget',
    :'comp_adjust_pct' => :'compAdjustPct',
    :'event_boost_enabled' => :'eventBoostEnabled',
    :'event_boost_max_pct' => :'eventBoostMaxPct'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 226

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



94
95
96
97
98
99
100
101
102
103
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 94

def self.openapi_nullable
  Set.new([
    :'min_price',
    :'max_price',
    :'weekend_markup_pct',
    :'target_occupancy_pct',
    :'target_monthly_revenue',
    :'owner_min_monthly_payout',
  ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'mode' => :'String',
    :'min_price' => :'Float',
    :'max_price' => :'Float',
    :'max_daily_change_pct' => :'Float',
    :'weekend_markup_pct' => :'Float',
    :'day_of_week_multipliers' => :'Hash<String, Float>',
    :'target_occupancy_pct' => :'Float',
    :'target_monthly_revenue' => :'Float',
    :'owner_min_monthly_payout' => :'Float',
    :'comp_position_target' => :'String',
    :'comp_adjust_pct' => :'Float',
    :'event_boost_enabled' => :'Boolean',
    :'event_boost_max_pct' => :'Float'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 193

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      mode == o.mode &&
      min_price == o.min_price &&
      max_price == o.max_price &&
      max_daily_change_pct == o.max_daily_change_pct &&
      weekend_markup_pct == o.weekend_markup_pct &&
      day_of_week_multipliers == o.day_of_week_multipliers &&
      target_occupancy_pct == o.target_occupancy_pct &&
      target_monthly_revenue == o.target_monthly_revenue &&
      owner_min_monthly_payout == o.owner_min_monthly_payout &&
      comp_position_target == o.comp_position_target &&
      comp_adjust_pct == o.comp_adjust_pct &&
      event_boost_enabled == o.event_boost_enabled &&
      event_boost_max_pct == o.event_boost_max_pct
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


213
214
215
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 213

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



219
220
221
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 219

def hash
  [mode, min_price, max_price, max_daily_change_pct, weekend_markup_pct, day_of_week_multipliers, target_occupancy_pct, target_monthly_revenue, owner_min_monthly_payout, comp_position_target, comp_adjust_pct, event_boost_enabled, event_boost_max_pct].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



178
179
180
181
182
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 178

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 248

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



186
187
188
189
# File 'lib/repull/models/listing_pricing_strategy_input.rb', line 186

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end