Skip to content
Browse files

first stab at offers - not working

  • Loading branch information...
1 parent 802fc30 commit a34b65c99b578e5eef82b4d814ff23935f440008 @nolastan nolastan committed Sep 12, 2012
Showing with 39 additions and 0 deletions.
  1. +1 −0 lib/taskrabbit.rb
  2. +13 −0 lib/taskrabbit/offer.rb
  3. +1 −0 lib/taskrabbit/task.rb
  4. +24 −0 spec/taskrabbit/offer_spec.rb
View
1 lib/taskrabbit.rb
@@ -14,6 +14,7 @@ module Taskrabbit
autoload :User, "taskrabbit/user"
autoload :City, "taskrabbit/city"
autoload :Location, "taskrabbit/location"
+ autoload :Offer, "taskrabbit/offer"
extend Config
end
View
13 lib/taskrabbit/offer.rb
@@ -0,0 +1,13 @@
+module Taskrabbit
+ class Offer < Smash
+ property :id
+ property :charge_price
+ property :state
+
+ class << self
+ def all(scope, options = {})
+ scope.request('get', scope.association_path(self), Api::collection_transformers[self], options)
+ end
+ end
+ end
+end
View
1 lib/taskrabbit/task.rb
@@ -23,6 +23,7 @@ class Task < Smash
property :state_changed_at, :transformer => TIME_TRANSFORMER
property :assign_by_time, :transformer => TIME_TRANSFORMER
property :location_visits, :transformer => Api::collection_transformers[Location]
+ property :offers, :transformer => Api::collection_transformers[Offer]
property :other_locations_attributes
property :uploaded_photos_attributes
property :uploaded_sounds_attributes
View
24 spec/taskrabbit/offer_spec.rb
@@ -0,0 +1,24 @@
+require 'spec_helper'
+
+describe Taskrabbit::Location do
+
+ describe "offers properties" do
+
+ before :all do
+ tr = Taskrabbit::Api.new(TR_USERS[:with_card][:secret])
+ VCR.use_cassette('tasks/properties', :record => :new_episodes) do
+ @tr_task = tr.tasks.find(22545)
+ @tr_task.fetch
+ end
+ VCR.use_cassette('offers/properties', :record => :new_episodes) do
+ @offer = @tr_task.offers.first
+ end
+ end
+
+ subject { @offer }
+
+ its(:id ) { should == 37439 }
+ its(:charge_price ) { should == "Home" }
+ its(:state ) { should == "432 example" }
+ end
+end

0 comments on commit a34b65c

Please sign in to comment.
Something went wrong with that request. Please try again.