Class: PQSDK::Leaflet
- Inherits:
-
RemoteObject
- Object
- RemoteObject
- PQSDK::Leaflet
- Defined in:
- lib/pqsdk/leaflet.rb
Overview
The Leaflet class provides an interface for crawlers to the v1/leaflets api endpoint.
Instance Attribute Summary collapse
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#id ⇒ Object
Returns the value of attribute id.
-
#image_urls ⇒ Object
Returns the value of attribute image_urls.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pdf_data ⇒ Object
Returns the value of attribute pdf_data.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#store_ids ⇒ Object
Returns the value of attribute store_ids.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from RemoteObject
all, #create, #create!, from_hash, get, #persisted?, #save, #save!, #update, #update!
Instance Attribute Details
#end_date ⇒ Object
Returns the value of attribute end_date.
10 11 12 |
# File 'lib/pqsdk/leaflet.rb', line 10 def end_date @end_date end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/pqsdk/leaflet.rb', line 10 def id @id end |
#image_urls ⇒ Object
Returns the value of attribute image_urls.
10 11 12 |
# File 'lib/pqsdk/leaflet.rb', line 10 def image_urls @image_urls end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/pqsdk/leaflet.rb', line 10 def name @name end |
#pdf_data ⇒ Object
Returns the value of attribute pdf_data.
10 11 12 |
# File 'lib/pqsdk/leaflet.rb', line 10 def pdf_data @pdf_data end |
#start_date ⇒ Object
Returns the value of attribute start_date.
10 11 12 |
# File 'lib/pqsdk/leaflet.rb', line 10 def start_date @start_date end |
#store_ids ⇒ Object
Returns the value of attribute store_ids.
10 11 12 |
# File 'lib/pqsdk/leaflet.rb', line 10 def store_ids @store_ids end |
#url ⇒ Object
Returns the value of attribute url.
10 11 12 |
# File 'lib/pqsdk/leaflet.rb', line 10 def url @url end |
Class Method Details
.find(url) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/pqsdk/leaflet.rb', line 22 def self.find(url) res = RestLayer.get(@endpoint, url: url, retailer_id: Token.retailer_id) return nil if res[0] == 404 raise "Unexpected HTTP status code #{res[0]}" unless res[0] == 200 from_hash res[1] end |
Instance Method Details
#attributes ⇒ Object
15 16 17 18 19 20 |
# File 'lib/pqsdk/leaflet.rb', line 15 def attributes { 'name' => nil, 'url' => nil, 'start_date' => nil, 'end_date' => nil, 'pdf_data' => nil, 'image_urls' => nil, 'store_ids' => nil } end |