class TescoRb::StoreRequester
Public Instance Methods
create_representations(client, hash_args)
click to toggle source
# File lib/tesco_rb/store_requester.rb, line 5 def create_representations(client, hash_args) response = request(client, update_args(hash_args)) # Raise Errors here? return [] unless response['results'] response['results'].map do |json| Store.new(json.fetch('location')) end end
Private Instance Methods
request(client, hash_args)
click to toggle source
# File lib/tesco_rb/store_requester.rb, line 24 def request(client, hash_args) client.get '/locations/search', query: hash_args end
update_args(args)
click to toggle source
# File lib/tesco_rb/store_requester.rb, line 16 def update_args(args) if args[:near] near_args = args.delete(:near) args[:sort] = "near:\"#{near_args}\"" end args end