class PQSDK::Leaflet

The Leaflet class provides an interface for crawlers to the v1/leaflets api endpoint.

Attributes

end_date[RW]
id[RW]
image_urls[RW]
name[RW]
pdf_data[RW]
start_date[RW]
store_ids[RW]
url[RW]

Public Class Methods

find(url) click to toggle source
# 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

Public Instance Methods

attributes() click to toggle source
# 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
pdf_data=(data) click to toggle source
# File lib/pqsdk/leaflet.rb, line 39
def pdf_data=(data)
  @pdf_data = Base64.encode64(data)
end