class PQSDK::Store
The Store
class provides an interface for crawlers to the v1/stores api endpoint.
Attributes
address[RW]
city[RW]
city_id[RW]
extra_infos[RW]
id[RW]
latitude[RW]
longitude[RW]
name[RW]
opening_hours[RW]
opening_hours_text[RW]
origin[RW]
phone[RW]
region[RW]
specific_distance[RW]
zipcode[RW]
Public Class Methods
find(address, zipcode, retailer = nil)
click to toggle source
# File lib/pqsdk/store.rb, line 28 def self.find(address, zipcode, retailer = nil) res = RestLayer.get(@endpoint, { address: address, zipcode: zipcode, retailer: retailer }, 'Authorization' => "Bearer #{Token.access_token}") if res[0] == 200 from_hash res[1] elsif res[0] == 404 nil else raise "Unexpected HTTP status code #{res[0]}, #{res[1]}" end end
from_hash(json)
click to toggle source
Calls superclass method
PQSDK::RemoteObject::from_hash
# File lib/pqsdk/store.rb, line 39 def self.from_hash(json) super(json.stringify_keys.except('city')) end
Public Instance Methods
attributes()
click to toggle source
# File lib/pqsdk/store.rb, line 15 def attributes { 'origin' => nil, 'name' => nil, 'address' => nil, 'latitude' => nil, 'longitude' => nil, 'city' => nil, 'city_id' => nil, 'zipcode' => nil, 'phone' => nil, 'opening_hours' => nil, 'opening_hours_text' => nil, 'region' => nil, 'extra_infos' => nil, 'specific_distance' => nil } end