teachstreet-ruby
This is a Ruby client for the TeachStreet API
For the specific documentation on APIs (and the full list of parameters) see:
Usage
To create a new client, use your API key
>> client = Teachstreet::Client.new('YOUR API KEY')
Then, make calls
>> listings = client.search_listings(:what => 'yoga', :where => 'Seattle, WA', :rpp => 1, :type => 'full')
=> [#<Teachstreet::Listing:0x7f5be3e15028 @attrs={"average_rating"=>4, "subcategory"=>"Yoga", "price_aggregates"=>{"session_count"=>"1", "max_price"=>"78", "has_free"=>"0", "min_price"=>"78"}, "uri"=>"http://www.teachstreet.com:80/yoga/stay-young-with-yoga/li-3e1vivdvr4", "category"=>"Health & Fitness", "title"=>"Stay Young With YOGA", "listing_sessions"=>[{"location"=>{"lon"=>-122.28756, "address"=>"2811 Mt Rainier Dr S, Seattle, WA, 98144", "lat"=>47.577783}, "title"=>"Yoga for Re-charging", "price_amount"=>78.0, "id"=>"cl-kje72a8uao", "teacher_id"=>"us-1lanqsg9zk", "when"=>["March 09, 2011 - June 27, 2011", " 6:15 PM - 7:30 PM"], "date_created"=>Tue Jul 20 15:22:52 -0700 2010}], "id"=>"li-3e1vivdvr4", "owner_id"=>"us-1lanqsg9zk", "rating_count"=>28, "category_id"=>502, "img_url"=>"http://images2.teachst.com/image/view?e=cr-100-100&id=im-3d0uo54v3k&reference_id=ir-30x29hh1r4", "description"=>"Would you benefit from recharging? Yoga can help. \r\n\r\nReaching your full potential requires mental and physical flexibility. Whether tight muscles come from intense athletic performance or from sitting at a desk all day, inflexibility limits your health, zaps your energy and constrains your freedom of movement. Yoga postures will inform you about which muscles are storing tension and about how to release them. And in this yoga class, you'll practice the body's natural mechanism for moving from anxiety to relaxation, deep breathing \342\200\223 and gain the bi-product of relaxing - mental flexibility. \r\nThis class is especially for \342\200\230baby-boomers, people without yoga training, & yoga veterans wanting a heart-centered experience, this class is accessible to everyone but deep in its impact. You\342\200\231ll be stretched and strengthened, your ability to focus will be enhanced and you\342\200\231ll come away feeling rejuvenated and ready to continue your day with new gusto. And you\342\200\231ll benefit from the side-effect of this practice, an upping of serotonin levels which boosts happiness! \r\nCertified Kripalu teacher. \r\n\r\n", "subcategory_id"=>514, "date_created"=>Tue Mar 03 13:40:26 -0800 2009}]
>> listings.first.title
=> "Stay Young With YOGA"
>> listings.first.listing_sessions.first
=> #<Teachstreet::ListingSession:0x7f5be3dba2e0 @attrs={"location"=>{"lon"=>-122.28756, "address"=>"2811 Mt Rainier Dr S, Seattle, WA, 98144", "lat"=>47.577783}, "title"=>"Yoga for Re-charging", "price_amount"=>78.0, "id"=>"cl-kje72a8uao", "teacher_id"=>"us-1lanqsg9zk", "when"=>["March 09, 2011 - June 27, 2011", " 6:15 PM - 7:30 PM"], "date_created"=>Tue Jul 20 15:22:52 -0700 2010}
JSON results are deserialized into classes: Listing, ListingSession, Location, Deal, Category, Subcategory, & PriceAggregates
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright © 2011 Scott Windsor & TeachStreet, Inc. See LICENSE for details.