Class: Repull::ListingPricingRecommendation

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

Overview

A pricing recommendation for one date in the listing’s calendar window.

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 = {}) ⇒ ListingPricingRecommendation

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
175
176
177
178
179
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 112

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::ListingPricingRecommendation` 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::ListingPricingRecommendation`. 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?(:'date')
    self.date = attributes[:'date']
  end

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

  if attributes.key?(:'recommended_price')
    self.recommended_price = attributes[:'recommended_price']
  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?(:'currency')
    self.currency = attributes[:'currency']
  end

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

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

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

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

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

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

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

Instance Attribute Details

#booking_probabilityObject

Expected booking probability for the date at the recommended price.



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

def booking_probability
  @booking_probability
end

#confidenceObject

Model confidence in [0, 1].



34
35
36
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 34

def confidence
  @confidence
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#current_priceObject

Current calendar price (from Vanio listings_calendar_days) before applying the recommendation.



22
23
24
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 22

def current_price
  @current_price
end

#dateObject

Returns the value of attribute date.



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

def date
  @date
end

#expected_revenueObject

Returns the value of attribute expected_revenue.



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

def expected_revenue
  @expected_revenue
end

#factorsObject

Free-form JSON of model factors (comp distance, event boost, weekend, demand, etc.).



42
43
44
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 42

def factors
  @factors
end

#generated_atObject

Returns the value of attribute generated_at.



49
50
51
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 49

def generated_at
  @generated_at
end

#max_priceObject

Returns the value of attribute max_price.



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

def max_price
  @max_price
end

#min_priceObject

Returns the value of attribute min_price.



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

def min_price
  @min_price
end

#model_versionObject

Returns the value of attribute model_version.



47
48
49
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 47

def model_version
  @model_version
end

Atlas model’s recommended price.



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

def recommended_price
  @recommended_price
end

#statusObject

Lifecycle state.



45
46
47
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 45

def status
  @status
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



71
72
73
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 71

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



76
77
78
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 76

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 52

def self.attribute_map
  {
    :'date' => :'date',
    :'current_price' => :'currentPrice',
    :'recommended_price' => :'recommendedPrice',
    :'min_price' => :'minPrice',
    :'max_price' => :'maxPrice',
    :'currency' => :'currency',
    :'confidence' => :'confidence',
    :'booking_probability' => :'bookingProbability',
    :'expected_revenue' => :'expectedRevenue',
    :'factors' => :'factors',
    :'status' => :'status',
    :'model_version' => :'modelVersion',
    :'generated_at' => :'generatedAt'
  }
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



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 231

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



100
101
102
103
104
105
106
107
108
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 100

def self.openapi_nullable
  Set.new([
    :'current_price',
    :'min_price',
    :'max_price',
    :'booking_probability',
    :'expected_revenue',
  ])
end

.openapi_typesObject

Attribute type mapping.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 81

def self.openapi_types
  {
    :'date' => :'Date',
    :'current_price' => :'Float',
    :'recommended_price' => :'Float',
    :'min_price' => :'Float',
    :'max_price' => :'Float',
    :'currency' => :'String',
    :'confidence' => :'Float',
    :'booking_probability' => :'Float',
    :'expected_revenue' => :'Float',
    :'factors' => :'Hash<String, Object>',
    :'status' => :'String',
    :'model_version' => :'String',
    :'generated_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 198

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      date == o.date &&
      current_price == o.current_price &&
      recommended_price == o.recommended_price &&
      min_price == o.min_price &&
      max_price == o.max_price &&
      currency == o.currency &&
      confidence == o.confidence &&
      booking_probability == o.booking_probability &&
      expected_revenue == o.expected_revenue &&
      factors == o.factors &&
      status == o.status &&
      model_version == o.model_version &&
      generated_at == o.generated_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


218
219
220
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 218

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



224
225
226
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 224

def hash
  [date, current_price, recommended_price, min_price, max_price, currency, confidence, booking_probability, expected_revenue, factors, status, model_version, generated_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



183
184
185
186
187
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 183

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



253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 253

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



191
192
193
194
# File 'lib/repull/models/listing_pricing_recommendation.rb', line 191

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