Love¶ ↑
This library accesses the Tender REST API. It is my ode to and thanks for the tender lovemaking Aaron Patterson is doing on ActiveRecord.
It is currently read-only, and made especially for scripts that import data from Tender to use in your own application. Feel free to fork and add missing API calls.
Why?¶ ↑
I previously used HTTParty to connect to the Tender API, but I ran into two issues:
-
HTTParty’s JSON decoding is really slow, and resulted in “stack level too deep” exceptions. Love uses yajl to decode JSON instead.
-
Because Tender does not check or convert the encoding of email messages that they receive, invalid UTF-8 characters can get into the system, which will break Ruby 1.9. Love handles character encoding manually, and will replace all the invalid UTF-8 characters by the UTF “unknown character” character.
-
I had to handle paging manually to get all data. Love will automatically send multiple requests to get all the pages to iterate over all the available objects.
Installation¶ ↑
Run gem install love
or add gem "love"
to your Gemfile.
Usage¶ ↑
require 'love' tender = Love.connect('site', 'api_key') # Loop over all discussions: tender.each_discussion do |discussion| # your awesome stuff here end # Also available: tender.each_user { |u| ... } tender.each_queue { |q| ... } tender.each_category { |c| ... } # Or get a single record, using an ID or HREF: d = tender.get_discussion('12345') u = tender.get_user('https://api.tenderapp.com/site/users/12345')
About¶ ↑
This library is written by Willem van Bergen for Shopify, and is MIT licensed.