Class: Repull::ListingPricingStrategy
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Repull::ListingPricingStrategy
- Defined in:
- lib/repull/models/listing_pricing_strategy.rb
Overview
Strategy that constrains the Atlas pricing model for one listing.
Instance Attribute Summary collapse
-
#comp_adjust_pct ⇒ Object
Extra adjustment vs comp median (-30..+30).
-
#comp_position_target ⇒ Object
Returns the value of attribute comp_position_target.
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#day_of_week_multipliers ⇒ Object
Multiplier per ISO weekday key (0..6).
-
#event_boost_enabled ⇒ Object
Returns the value of attribute event_boost_enabled.
-
#event_boost_max_pct ⇒ Object
Returns the value of attribute event_boost_max_pct.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_default ⇒ Object
true when no row exists yet and the response is server-side defaults.
-
#listing_id ⇒ Object
Returns the value of attribute listing_id.
-
#max_daily_change_pct ⇒ Object
Max day-over-day swing in %.
-
#max_price ⇒ Object
Returns the value of attribute max_price.
-
#min_price ⇒ Object
Returns the value of attribute min_price.
-
#mode ⇒ Object
‘recommend` surfaces suggestions; `auto` applies them on the next sync.
-
#owner_min_monthly_payout ⇒ Object
Returns the value of attribute owner_min_monthly_payout.
-
#target_monthly_revenue ⇒ Object
Returns the value of attribute target_monthly_revenue.
-
#target_occupancy_pct ⇒ Object
Returns the value of attribute target_occupancy_pct.
-
#weekend_markup_pct ⇒ Object
% bump applied on Fri/Sat.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ListingPricingStrategy
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ ListingPricingStrategy
Initializes the object
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 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 130 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::ListingPricingStrategy` 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::ListingPricingStrategy`. 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?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'listing_id') self.listing_id = attributes[:'listing_id'] end if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] end 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'] else self.max_daily_change_pct = 15 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'] else self.comp_position_target = 'match' end if attributes.key?(:'comp_adjust_pct') self.comp_adjust_pct = attributes[:'comp_adjust_pct'] else self.comp_adjust_pct = 0 end if attributes.key?(:'event_boost_enabled') self.event_boost_enabled = attributes[:'event_boost_enabled'] else self.event_boost_enabled = true end if attributes.key?(:'event_boost_max_pct') self.event_boost_max_pct = attributes[:'event_boost_max_pct'] else self.event_boost_max_pct = 30 end if attributes.key?(:'is_default') self.is_default = attributes[:'is_default'] end end |
Instance Attribute Details
#comp_adjust_pct ⇒ Object
Extra adjustment vs comp median (-30..+30).
50 51 52 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 50 def comp_adjust_pct @comp_adjust_pct end |
#comp_position_target ⇒ Object
Returns the value of attribute comp_position_target.
47 48 49 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 47 def comp_position_target @comp_position_target end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
23 24 25 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 23 def customer_id @customer_id end |
#day_of_week_multipliers ⇒ Object
Multiplier per ISO weekday key (0..6).
39 40 41 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 39 def day_of_week_multipliers @day_of_week_multipliers end |
#event_boost_enabled ⇒ Object
Returns the value of attribute event_boost_enabled.
52 53 54 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 52 def event_boost_enabled @event_boost_enabled end |
#event_boost_max_pct ⇒ Object
Returns the value of attribute event_boost_max_pct.
54 55 56 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 54 def event_boost_max_pct @event_boost_max_pct end |
#id ⇒ Object
Returns the value of attribute id.
19 20 21 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 19 def id @id end |
#is_default ⇒ Object
true when no row exists yet and the response is server-side defaults.
57 58 59 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 57 def is_default @is_default end |
#listing_id ⇒ Object
Returns the value of attribute listing_id.
21 22 23 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 21 def listing_id @listing_id end |
#max_daily_change_pct ⇒ Object
Max day-over-day swing in %.
33 34 35 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 33 def max_daily_change_pct @max_daily_change_pct end |
#max_price ⇒ Object
Returns the value of attribute max_price.
30 31 32 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 30 def max_price @max_price end |
#min_price ⇒ Object
Returns the value of attribute min_price.
28 29 30 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 28 def min_price @min_price end |
#mode ⇒ Object
‘recommend` surfaces suggestions; `auto` applies them on the next sync.
26 27 28 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 26 def mode @mode end |
#owner_min_monthly_payout ⇒ Object
Returns the value of attribute owner_min_monthly_payout.
45 46 47 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 45 def owner_min_monthly_payout @owner_min_monthly_payout end |
#target_monthly_revenue ⇒ Object
Returns the value of attribute target_monthly_revenue.
43 44 45 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 43 def target_monthly_revenue @target_monthly_revenue end |
#target_occupancy_pct ⇒ Object
Returns the value of attribute target_occupancy_pct.
41 42 43 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 41 def target_occupancy_pct @target_occupancy_pct end |
#weekend_markup_pct ⇒ Object
% bump applied on Fri/Sat.
36 37 38 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 36 def weekend_markup_pct @weekend_markup_pct end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
83 84 85 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 83 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
88 89 90 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 88 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 60 def self.attribute_map { :'id' => :'id', :'listing_id' => :'listingId', :'customer_id' => :'customerId', :'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', :'is_default' => :'isDefault' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 279 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_nullable ⇒ Object
List of attributes with nullable: true
116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 116 def self.openapi_nullable Set.new([ :'id', :'min_price', :'max_price', :'weekend_markup_pct', :'target_occupancy_pct', :'target_monthly_revenue', :'owner_min_monthly_payout', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 93 def self.openapi_types { :'id' => :'String', :'listing_id' => :'String', :'customer_id' => :'String', :'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', :'is_default' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 242 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && listing_id == o.listing_id && customer_id == o.customer_id && 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 && is_default == o.is_default end |
#eql?(o) ⇒ Boolean
266 267 268 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 266 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
272 273 274 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 272 def hash [id, listing_id, customer_id, 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, is_default].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
227 228 229 230 231 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 227 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 301 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
235 236 237 238 |
# File 'lib/repull/models/listing_pricing_strategy.rb', line 235 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |