Class: ShopsavvyDataApi::ScheduledProduct

Inherits:
Object
  • Object
show all
Defined in:
lib/shopsavvy_data_api/models.rb

Overview

Scheduled product monitoring information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ScheduledProduct

Returns a new instance of ScheduledProduct.



176
177
178
179
180
181
182
183
# File 'lib/shopsavvy_data_api/models.rb', line 176

def initialize(data)
  @product_id = data["product_id"]
  @identifier = data["identifier"]
  @frequency = data["frequency"]
  @retailer = data["retailer"]
  @created_at = data["created_at"]
  @last_refreshed = data["last_refreshed"]
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



173
174
175
# File 'lib/shopsavvy_data_api/models.rb', line 173

def created_at
  @created_at
end

#frequencyObject (readonly)

Returns the value of attribute frequency.



173
174
175
# File 'lib/shopsavvy_data_api/models.rb', line 173

def frequency
  @frequency
end

#identifierObject (readonly)

Returns the value of attribute identifier.



173
174
175
# File 'lib/shopsavvy_data_api/models.rb', line 173

def identifier
  @identifier
end

#last_refreshedObject (readonly)

Returns the value of attribute last_refreshed.



173
174
175
# File 'lib/shopsavvy_data_api/models.rb', line 173

def last_refreshed
  @last_refreshed
end

#product_idObject (readonly)

Returns the value of attribute product_id.



173
174
175
# File 'lib/shopsavvy_data_api/models.rb', line 173

def product_id
  @product_id
end

#retailerObject (readonly)

Returns the value of attribute retailer.



173
174
175
# File 'lib/shopsavvy_data_api/models.rb', line 173

def retailer
  @retailer
end

Instance Method Details

#daily?Boolean

Returns:

  • (Boolean)


200
201
202
# File 'lib/shopsavvy_data_api/models.rb', line 200

def daily?
  frequency == "daily"
end

#hourly?Boolean

Returns:

  • (Boolean)


196
197
198
# File 'lib/shopsavvy_data_api/models.rb', line 196

def hourly?
  frequency == "hourly"
end

#to_hObject



185
186
187
188
189
190
191
192
193
194
# File 'lib/shopsavvy_data_api/models.rb', line 185

def to_h
  {
    product_id: product_id,
    identifier: identifier,
    frequency: frequency,
    retailer: retailer,
    created_at: created_at,
    last_refreshed: last_refreshed
  }
end

#weekly?Boolean

Returns:

  • (Boolean)


204
205
206
# File 'lib/shopsavvy_data_api/models.rb', line 204

def weekly?
  frequency == "weekly"
end