Project

love

0.01
No commit activity in last 3 years
No release in over 3 years
A simple API wrapper for Tender, that handles paged results, uses yajl-ruby for JSON parsing, and manually handles UTF-8 encoding to circumvent the invalid UTF-8 character problem in Ruby 1.9.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 2

Runtime

 Project Readme

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.