Project

tesco_rb

0.0
No commit activity in last 3 years
No release in over 3 years
Navigate the Tesco API: https://devportal.tescolabs.com/docs/services/
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
>= 2.1.1, ~> 2.1
~> 5.0
>= 3.4.0, ~> 3.4
~> 10.0
>= 3.0.3, ~> 3.0
>= 2.1.0, ~> 2.1

Runtime

~> 0.14.0
 Project Readme

TescoRb

https://api.travis-ci.org/wmmc/tesco_rb.svg

A ruby gem for interacting with the Tesco Api. Currently it supports Grocery & Store Location end points.

Usage Examples:

client = TescoRb.new(YOUR_API_KEY)

# To search for items:
client.search('bananas')
#        => [#<TescoRb::Item:0x007fae80828fa8
#                @AverageSellingUnitWeight=2.402,
#                @ContentsMeasureType="KG",
#                @ContentsQuantity=1.0,
#                @PromotionDescription="25 extra points on any bananas",
#                @UnitOfSale=3,
#                @UnitQuantity="KG",
#                @image="http://img.tesco.com/Groceries/pi/000/0261480000000/IDShot_90x90.jpg",
#                @name="Tesco Bananas Loose",
#                @price=0.68,
#                @tpnb=50502269,
#                @unitprice=0.68>
#            ..... ]

# Another way to search for items:
client.item(query: 'bananas', limit: 10)             # page 1
client.item(query: 'bananas', limit: 10, offset: 10) # page 2

# To search for Shops:
client.store(near: 'SW5 4YY')
client.store(near: 'SW5 4YY', limit: 5)
client.store(filter: 'isoCountryCode:GB AND category:Store AND facilities:DBT')

# An example shop:
#            <TescoRb::Store:0x007fae80ca1ad0
#              @address=
#               #<TescoRb::Address:0x007fae80ca1300
#                @lines=
#                 [{"lineNumber"=>1, "text"=>"87-93 Gloucester Rd"},
#                  {"lineNumber"=>2, "text"=>"South Kensington"}],
#                @postcode="SW7 4SS",
#                @town="London">,
#              @altIds={"branchNumber"=>2745},
#              @classification={"type"=>"Express", "category"=>"Store"},
#              @facilities=[]
#              @region={"isoCountryCode"=>"GB"},
#              @status={"currentStatus"=>"Trading"}>

Installation

Add this line to your application’s Gemfile:

gem 'tesco_rb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tesco_rb

Todo

  • DRY / subclass requesters
  • OpeningHours Object
  • GeoLocation Object
  • Get rid of linting errors
  • Think about exceptions / error handling
  • Pagination