taskrabbit 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,6 +2,5 @@
2
2
  .bundle
3
3
  .idea
4
4
  Gemfile.lock
5
- .rvmrc
6
5
  pkg/*
7
- bin
6
+ bin
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use ruby-1.9.3-p194@taskrabbit_client
@@ -1,3 +1,11 @@
1
+ ## v0.0.5
2
+
3
+ * add compatibility with ruby 1.9.3
4
+
5
+ ## v0.0.4
6
+
7
+ * add number\_runner\_to\_fill to Task.
8
+
1
9
  ## v0.0.3
2
10
 
3
11
  * update default uri to secure connection.
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ group :development do
7
7
  gem 'rdoc'
8
8
  gem 'rake'
9
9
  gem 'yard'
10
- gem 'ruby-debug'
10
+ gem 'debugger'
11
11
  gem 'pry'
12
12
  gem 'awesome_print'
13
13
  end
@@ -19,5 +19,5 @@ group :test do
19
19
  gem 'growl'
20
20
  gem 'vcr', '~> 1.11.3'
21
21
  gem 'fakeweb'
22
- gem 'rcov', :require => nil
22
+ gem 'simplecov'
23
23
  end
data/README.md CHANGED
@@ -19,13 +19,14 @@ Or in a Gemfile:
19
19
 
20
20
  In an initializer file.
21
21
 
22
- Taskrabbit.configure do |config|
23
- config.api_secret = 'your-client-secret'
24
- config.api_key = 'your-client-key'
25
- config.base_uri = 'https://sandbox.com'
26
- config.endpoint = 'api/v2'
27
- end
28
-
22
+ ```ruby
23
+ Taskrabbit.configure do |config|
24
+ config.api_secret = 'your-client-secret'
25
+ config.api_key = 'your-client-key'
26
+ config.base_uri = 'https://sandbox.com'
27
+ config.endpoint = 'api/v2'
28
+ end
29
+ ```
29
30
  Available configuration options:
30
31
 
31
32
  * api_secret: client secret that has been given to you by TaskRabbit
@@ -37,96 +38,126 @@ Available configuration options:
37
38
 
38
39
  ### use the API client
39
40
 
40
- tr = Taskrabbit::Api.new
41
-
41
+ ```ruby
42
+ tr = Taskrabbit::Api.new
43
+ ```
44
+
42
45
  or with a user token returned by TaskRabbit.
43
46
 
44
- tr = Taskrabbit::Api.new(user_token)
47
+ ```ruby
48
+ tr = Taskrabbit::Api.new(user_token)
49
+ ```
45
50
 
46
51
  ### Get the list of all the tasks
47
52
 
48
- tr = Taskrabbit::Api.new
49
- # to get the /tasks
50
- tasks = tr.tasks.all
51
- # fetch the first task
52
- tasks.first
53
-
54
- tasks.all(:reload => true) # => will redo the query
53
+ ```ruby
54
+ tr = Taskrabbit::Api.new
55
+ # to get the /tasks
56
+ tasks = tr.tasks.all
57
+ # fetch the first task
58
+ tasks.first
59
+
60
+ tasks.all(:reload => true) # => will redo the query
61
+ ```
55
62
 
56
63
  ### Find a task
57
64
 
58
- tr = Taskrabbit::Api.new
59
- t = tr.tasks.find(31231) # This actually wont do the request
65
+ ```ruby
66
+ tr = Taskrabbit::Api.new
67
+ t = tr.tasks.find(31231) # This actually wont do the request
68
+ ```
60
69
 
61
70
  To request the API:
62
71
 
63
- t.fetch # force fetching
72
+ ```ruby
73
+ t.fetch # force fetching
74
+ ```
64
75
 
65
76
  or simply access a property:
66
77
 
67
- t.name # will do the query
78
+ ```ruby
79
+ t.name # will do the query
80
+ ```
68
81
 
69
82
  ### Find the tasks of an user
70
83
 
71
- tr.users.find(user_id).tasks
84
+ ```ruby
85
+ tr.users.find(user_id).tasks
86
+ ```
72
87
 
73
88
  ### Create a task
74
89
 
75
- tr = Taskrabbit::Api.new(user_token)
76
- task = tr.tasks.create({:named_price => 32, :name => 'Ikea'})
90
+ ```ruby
91
+ tr = Taskrabbit::Api.new(user_token)
92
+ task = tr.tasks.create({:named_price => 32, :name => 'Ikea'})
93
+ ```
77
94
 
78
95
  or
79
96
 
80
- task = tr.tasks.new({:named_price => 32, :name => 'Ikea'})
81
- task.save
97
+ ```ruby
98
+ task = tr.tasks.new({:named_price => 32, :name => 'Ikea'})
99
+ task.save
100
+ ```
82
101
 
83
102
  ### Update a task
84
103
 
85
- task = tr.tasks.find(32121)
86
- task.named_price = 45
87
- task.save
104
+ ```ruby
105
+ task = tr.tasks.find(32121)
106
+ task.named_price = 45
107
+ task.save
108
+ ```
88
109
 
89
110
  ### Error for tasks creation or update
90
111
 
91
- tr = Taskrabbit::Api.new(user_token)
92
- task = tr.tasks.new
93
- unless task.save
94
- task.error # => "Task title can't be blank, \nAmount you are willing to pay is not a number"
95
- task.errors # => { "messages" => ["Task title can't be blank", "Amount you are willing to pay is not a number"],
96
- "fields" => [["name","can't be blank"], ["named_price","is not a number"]] }
97
- end
112
+ ```ruby
113
+ tr = Taskrabbit::Api.new(user_token)
114
+ task = tr.tasks.new
115
+ unless task.save
116
+ task.error # => "Task title can't be blank, \nAmount you are willing to pay is not a number"
117
+ task.errors # => { "messages" => ["Task title can't be blank", "Amount you are willing to pay is not a number"],
118
+ "fields" => [["name","can't be blank"], ["named_price","is not a number"]] }
119
+ end
120
+ ```
98
121
 
99
122
  ### Redirect
100
123
 
101
124
  In some case TaskRabbit will return an url which should be used for further operations (i.e: when the user doesn't have a credit card).
102
125
 
103
- tr = Taskrabbit::Api.new(user_token)
104
- task = tr.tasks.new
105
- unless task.save
106
- if task.redirect?
107
- task.redirect_url #=> 'http://www.taskrabbit.com/somepath'
108
- end
109
- end
126
+ ```ruby
127
+ tr = Taskrabbit::Api.new(user_token)
128
+ task = tr.tasks.new
129
+ unless task.save
130
+ if task.redirect?
131
+ task.redirect_url #=> 'http://www.taskrabbit.com/somepath'
132
+ end
133
+ end
134
+ ```
110
135
 
111
136
  ## User account
112
137
 
113
- tr = Taskrabbit::Api.new(user_token)
114
- tr.account # => Taskrabbit::User object
138
+ ```ruby
139
+ tr = Taskrabbit::Api.new(user_token)
140
+ tr.account # => Taskrabbit::User object
115
141
 
116
- tr.account.tasks # => List of tasks
117
- tr.account.tasks.create(some_params)
142
+ tr.account.tasks # => List of tasks
143
+ tr.account.tasks.create(some_params)
144
+ ```
118
145
 
119
146
  ## Cities
120
147
 
121
148
  ### Get list of cities
122
149
 
123
- tr.cities.each do |city|
124
- city.name
125
- end
150
+ ```ruby
151
+ tr.cities.each do |city|
152
+ city.name
153
+ end
154
+ ```
126
155
 
127
156
  ### Find a city using the id
128
157
 
129
- tr.cities.find(3).name # => "SF Bay Area"
158
+ ```ruby
159
+ tr.cities.find(3).name # => "SF Bay Area"
160
+ ```
130
161
 
131
162
  ### More informations
132
163
 
@@ -1,9 +1,9 @@
1
- class BasicObject #:nodoc:
1
+ class BaseObject #:nodoc:
2
2
  instance_methods.each { |m| undef_method m unless m =~ /(^__|^nil\?$|^send$|instance_eval|proxy_|^object_id$)/ }
3
- end unless defined?(BasicObject)
3
+ end unless defined?(BaseObject)
4
4
 
5
5
  module Taskrabbit
6
- class Proxy < BasicObject
6
+ class Proxy < BaseObject
7
7
 
8
8
  COLLECTION_DELEGATE = %w{first last count size length each keys links}.freeze
9
9
 
@@ -8,6 +8,7 @@ module Taskrabbit
8
8
  property :named_price
9
9
  property :charge_price
10
10
  property :cost_in_cents
11
+ property :number_runners_to_fill
11
12
  property :links
12
13
  property :state_label
13
14
  property :city_id
@@ -1,3 +1,3 @@
1
1
  module Taskrabbit
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -30,7 +30,7 @@ describe Taskrabbit::City do
30
30
  expect { cities = tr.cities }.to_not raise_error
31
31
  cities.should == Taskrabbit::City
32
32
  cities.count.should > 0
33
- cities.keys.should == ["items", "links"]
33
+ cities.keys.should =~ ["items", "links"]
34
34
  cities.links
35
35
  cities.each do |city|
36
36
  city.should be_instance_of Taskrabbit::City
@@ -35,6 +35,12 @@ describe Taskrabbit::Task do
35
35
  its(:complete_by_time) { should be_instance_of(Time) }
36
36
  its(:state_changed_at) { should be_instance_of(Time) }
37
37
  its(:links) { should be_instance_of(Hash) }
38
+
39
+ it "allows passing number_runners_to_fill" do
40
+ tr = Taskrabbit::Api.new(TR_USERS[:without_card][:secret])
41
+ tr_task = tr.tasks.new(valid_params.merge({:number_runners_to_fill => 3}))
42
+ tr_task.number_runners_to_fill.should == 3
43
+ end
38
44
  end
39
45
 
40
46
  let(:valid_params) {
metadata CHANGED
@@ -1,98 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: taskrabbit
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 3
10
- version: 0.0.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jean-Richard Lai
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-06-21 00:00:00 -07:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-08-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: api_smith
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - "="
28
- - !ruby/object:Gem::Version
29
- hash: 23
30
- segments:
31
- - 1
32
- - 0
33
- - 0
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
34
21
  version: 1.0.0
35
22
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: rspec
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
41
33
  none: false
42
- requirements:
34
+ requirements:
43
35
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 23
46
- segments:
47
- - 2
48
- - 6
49
- - 0
36
+ - !ruby/object:Gem::Version
50
37
  version: 2.6.0
51
38
  type: :development
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: vcr
55
39
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.6.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: vcr
48
+ requirement: !ruby/object:Gem::Requirement
57
49
  none: false
58
- requirements:
50
+ requirements:
59
51
  - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 61
62
- segments:
63
- - 1
64
- - 11
65
- - 3
52
+ - !ruby/object:Gem::Version
66
53
  version: 1.11.3
67
54
  type: :development
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
- name: rdoc
71
55
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
73
57
  none: false
74
- requirements:
58
+ requirements:
75
59
  - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 31
78
- segments:
79
- - 3
80
- - 12
81
- version: "3.12"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.11.3
62
+ - !ruby/object:Gem::Dependency
63
+ name: rdoc
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '3.12'
82
70
  type: :development
83
- version_requirements: *id004
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '3.12'
84
78
  description: Client for the TaskRabbit API
85
- email:
79
+ email:
86
80
  - jrichardlai@gmail.com
87
81
  executables: []
88
-
89
82
  extensions: []
90
-
91
83
  extra_rdoc_files: []
92
-
93
- files:
84
+ files:
94
85
  - .gitignore
95
86
  - .rspec
87
+ - .rvmrc
96
88
  - CHANGELOG.md
97
89
  - Gemfile
98
90
  - Guardfile
@@ -151,43 +143,34 @@ files:
151
143
  - spec/taskrabbit/taskrabbit_spec.rb
152
144
  - spec/taskrabbit/user_spec.rb
153
145
  - taskrabbit.gemspec
154
- has_rdoc: true
155
- homepage: ""
146
+ homepage: ''
156
147
  licenses: []
157
-
158
148
  post_install_message:
159
149
  rdoc_options: []
160
-
161
- require_paths:
150
+ require_paths:
162
151
  - lib
163
- required_ruby_version: !ruby/object:Gem::Requirement
152
+ required_ruby_version: !ruby/object:Gem::Requirement
164
153
  none: false
165
- requirements:
166
- - - ">="
167
- - !ruby/object:Gem::Version
168
- hash: 3
169
- segments:
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ segments:
170
159
  - 0
171
- version: "0"
172
- required_rubygems_version: !ruby/object:Gem::Requirement
160
+ hash: -3232776619035883631
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
162
  none: false
174
- requirements:
175
- - - ">="
176
- - !ruby/object:Gem::Version
177
- hash: 23
178
- segments:
179
- - 1
180
- - 3
181
- - 6
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
182
166
  version: 1.3.6
183
167
  requirements: []
184
-
185
168
  rubyforge_project: taskrabbit
186
- rubygems_version: 1.5.3
169
+ rubygems_version: 1.8.24
187
170
  signing_key:
188
171
  specification_version: 3
189
172
  summary: Client for the TaskRabbit API
190
- test_files:
173
+ test_files:
191
174
  - spec/spec_helper.rb
192
175
  - spec/support/cassettes/account/no_user.yml
193
176
  - spec/support/cassettes/account/properties.yml
@@ -224,3 +207,4 @@ test_files:
224
207
  - spec/taskrabbit/task_spec.rb
225
208
  - spec/taskrabbit/taskrabbit_spec.rb
226
209
  - spec/taskrabbit/user_spec.rb
210
+ has_rdoc: