checkdin 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/lib/checkdin/users.rb +42 -0
  2. data/lib/checkdin/version.rb +1 -1
  3. metadata +168 -143
  4. data/.document +0 -5
  5. data/.rspec +0 -1
  6. data/Gemfile.lock +0 -59
  7. data/spec/checkdin/activities_spec.rb +0 -72
  8. data/spec/checkdin/campaigns_spec.rb +0 -32
  9. data/spec/checkdin/client_spec.rb +0 -29
  10. data/spec/checkdin/clients_spec.rb +0 -23
  11. data/spec/checkdin/custom_activities_spec.rb +0 -13
  12. data/spec/checkdin/leaderboard_spec.rb +0 -28
  13. data/spec/checkdin/promotions_spec.rb +0 -63
  14. data/spec/checkdin/push_api_subscriptions_spec.rb +0 -50
  15. data/spec/checkdin/user_bridge_spec.rb +0 -148
  16. data/spec/checkdin/users_spec.rb +0 -109
  17. data/spec/checkdin/won_rewards_spec.rb +0 -45
  18. data/spec/fixtures/vcr_cassettes/Checkdin_Activities/viewing_a_list_of_activities.yml +0 -44
  19. data/spec/fixtures/vcr_cassettes/Checkdin_Activities/viewing_a_single_activity.yml +0 -44
  20. data/spec/fixtures/vcr_cassettes/Checkdin_Activities/voting_for_an_activity/passing_an_email.yml +0 -48
  21. data/spec/fixtures/vcr_cassettes/Checkdin_Activities/voting_for_an_activity.yml +0 -48
  22. data/spec/fixtures/vcr_cassettes/Checkdin_Campaigns/viewing_a_list_of_campaigns.yml +0 -43
  23. data/spec/fixtures/vcr_cassettes/Checkdin_Campaigns/viewing_a_single_campaign.yml +0 -51
  24. data/spec/fixtures/vcr_cassettes/Checkdin_Clients/viewing_a_client_s_own_information.yml +0 -46
  25. data/spec/fixtures/vcr_cassettes/Checkdin_CustomActivities.yml +0 -47
  26. data/spec/fixtures/vcr_cassettes/Checkdin_Leaderboard/viewing_a_leaderboard_for_a_campaign.yml +0 -42
  27. data/spec/fixtures/vcr_cassettes/Checkdin_Leaderboard/viewing_a_leaderboard_for_a_campaign_s_classifications.yml +0 -46
  28. data/spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_a_list_of_promotions.yml +0 -58
  29. data/spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_a_single_promotion.yml +0 -51
  30. data/spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_the_votes_leaderboard_for_a_promotion/limiting_the_number_of_records_returned.yml +0 -44
  31. data/spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_the_votes_leaderboard_for_a_promotion.yml +0 -44
  32. data/spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/disabling_a_push_api_subscription.yml +0 -32
  33. data/spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/enabling_a_push_api_subscription.yml +0 -32
  34. data/spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/viewing_a_list_of_push_api_subscriptions.yml +0 -32
  35. data/spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/viewing_a_single_push_api_subscription.yml +0 -32
  36. data/spec/fixtures/vcr_cassettes/Checkdin_Users/viewing_a_list_of_users.yml +0 -42
  37. data/spec/fixtures/vcr_cassettes/Checkdin_Users/viewing_a_single_user.yml +0 -59
  38. data/spec/fixtures/vcr_cassettes/Checkdin_Votes/filtering_by_a_single_user.yml +0 -44
  39. data/spec/fixtures/vcr_cassettes/Checkdin_Votes/viewing_a_list_of_activities.yml +0 -44
  40. data/spec/fixtures/vcr_cassettes/Checkdin_WonRewards/viewing_a_list_of_won_rewards.yml +0 -53
  41. data/spec/fixtures/vcr_cassettes/Checkdin_WonRewards/viewing_a_single_won_reward.yml +0 -49
  42. data/spec/spec_helper.rb +0 -49
@@ -92,6 +92,48 @@ module Checkdin
92
92
  return_error_or_body(response)
93
93
  end
94
94
 
95
+ # Get a list of all blacklisted users for the authenticating client.
96
+ #
97
+ # @param [Hash] options
98
+ # @option options Integer :limit - The maximum number of records to return.
99
+
100
+ def blacklisted(options={})
101
+ response = connection.get do |req|
102
+ req.url "users/blacklisted", options
103
+ end
104
+ return_error_or_body(response)
105
+ end
106
+
107
+ # Blacklist user from creating activities
108
+ #
109
+ # param [Integer] id The ID of the user
110
+
111
+ def blacklist(id)
112
+ response = connection.put("users/#{id}/blacklist")
113
+ return_error_or_body(response)
114
+ end
115
+
116
+ # Whitelist user that has been blacklisted
117
+ #
118
+ # param [Integer] id The ID of the user
119
+
120
+ def whitelist(id)
121
+ response = connection.delete("users/#{id}/blacklist")
122
+ return_error_or_body(response)
123
+ end
124
+
125
+ # Create a point redemption for a user
126
+ #
127
+ # param [Integer] id The ID of the user
128
+ # @param [Hash] options This options hash will store any non-required parameters for later use.
129
+ # @option options String :point_value - The number of points to redeem, required.
130
+
131
+ def create_user_point_redemption(id, options={})
132
+ response = connection.post do |req|
133
+ req.url "users/#{id}/point_redemptions", options
134
+ end
135
+ return_error_or_body(response)
136
+ end
95
137
 
96
138
  end
97
139
  end
@@ -1,3 +1,3 @@
1
1
  module Checkdin
2
- VERSION = '0.2.9'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,153 +1,218 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: checkdin
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
4
5
  prerelease:
5
- version: 0.2.9
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Matt Mueller
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-03-11 00:00:00 -06:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: faraday
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
18
+ requirements:
22
19
  - - ~>
23
- - !ruby/object:Gem::Version
24
- version: "0.8"
20
+ - !ruby/object:Gem::Version
21
+ version: '0.8'
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: faraday_middleware
29
23
  prerelease: false
30
- 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: '0.8'
30
+ - !ruby/object:Gem::Dependency
31
+ name: faraday_middleware
32
+ requirement: !ruby/object:Gem::Requirement
31
33
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
36
38
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: hashie
40
39
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
42
41
  none: false
43
- requirements:
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: hashie
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
44
51
  - - ~>
45
- - !ruby/object:Gem::Version
46
- version: "1.0"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.0'
47
54
  type: :runtime
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: activesupport
51
55
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: activesupport
64
+ requirement: !ruby/object:Gem::Requirement
53
65
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
57
69
  version: 2.0.3
58
70
  type: :runtime
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
61
- name: rspec
62
71
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 2.0.3
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec
80
+ requirement: !ruby/object:Gem::Requirement
64
81
  none: false
65
- requirements:
82
+ requirements:
66
83
  - - ~>
67
- - !ruby/object:Gem::Version
84
+ - !ruby/object:Gem::Version
68
85
  version: 2.8.0
69
86
  type: :development
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
72
- name: rdoc
73
87
  prerelease: false
74
- requirement: &id006 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 2.8.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: rdoc
96
+ requirement: !ruby/object:Gem::Requirement
75
97
  none: false
76
- requirements:
98
+ requirements:
77
99
  - - ~>
78
- - !ruby/object:Gem::Version
79
- version: "3.12"
100
+ - !ruby/object:Gem::Version
101
+ version: '3.12'
80
102
  type: :development
81
- version_requirements: *id006
82
- - !ruby/object:Gem::Dependency
83
- name: bundler
84
103
  prerelease: false
85
- requirement: &id007 !ruby/object:Gem::Requirement
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '3.12'
110
+ - !ruby/object:Gem::Dependency
111
+ name: bundler
112
+ requirement: !ruby/object:Gem::Requirement
86
113
  none: false
87
- requirements:
114
+ requirements:
88
115
  - - ~>
89
- - !ruby/object:Gem::Version
90
- version: "1.0"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.0'
91
118
  type: :development
92
- version_requirements: *id007
93
- - !ruby/object:Gem::Dependency
94
- name: simplecov
95
119
  prerelease: false
96
- requirement: &id008 !ruby/object:Gem::Requirement
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '1.0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: simplecov
128
+ requirement: !ruby/object:Gem::Requirement
97
129
  none: false
98
- requirements:
130
+ requirements:
99
131
  - - ~>
100
- - !ruby/object:Gem::Version
132
+ - !ruby/object:Gem::Version
101
133
  version: 0.5.4
102
134
  type: :development
103
- version_requirements: *id008
104
- - !ruby/object:Gem::Dependency
105
- name: webmock
106
135
  prerelease: false
107
- requirement: &id009 !ruby/object:Gem::Requirement
136
+ version_requirements: !ruby/object:Gem::Requirement
108
137
  none: false
109
- requirements:
138
+ requirements:
110
139
  - - ~>
111
- - !ruby/object:Gem::Version
140
+ - !ruby/object:Gem::Version
141
+ version: 0.5.4
142
+ - !ruby/object:Gem::Dependency
143
+ name: webmock
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
112
149
  version: 1.7.10
113
150
  type: :development
114
- version_requirements: *id009
115
- - !ruby/object:Gem::Dependency
116
- name: vcr
117
151
  prerelease: false
118
- requirement: &id010 !ruby/object:Gem::Requirement
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: 1.7.10
158
+ - !ruby/object:Gem::Dependency
159
+ name: vcr
160
+ requirement: !ruby/object:Gem::Requirement
119
161
  none: false
120
- requirements:
162
+ requirements:
121
163
  - - ~>
122
- - !ruby/object:Gem::Version
164
+ - !ruby/object:Gem::Version
123
165
  version: 1.11.3
124
166
  type: :development
125
- version_requirements: *id010
126
- - !ruby/object:Gem::Dependency
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: 1.11.3
174
+ - !ruby/object:Gem::Dependency
127
175
  name: timecop
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :development
128
183
  prerelease: false
129
- requirement: &id011 !ruby/object:Gem::Requirement
184
+ version_requirements: !ruby/object:Gem::Requirement
130
185
  none: false
131
- requirements:
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- version: "0"
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ - !ruby/object:Gem::Dependency
191
+ name: rake
192
+ requirement: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
135
198
  type: :development
136
- version_requirements: *id011
137
- description: Ruby gem for interacting with the checkd.in API. See http://checkd.in or http://developer.checkd.in for more information.
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ description: Ruby gem for interacting with the checkd.in API. See http://checkd.in
207
+ or http://developer.checkd.in for more information.
138
208
  email: muellermr@gmail.com
139
209
  executables: []
140
-
141
210
  extensions: []
142
-
143
- extra_rdoc_files:
211
+ extra_rdoc_files:
144
212
  - LICENSE.txt
145
213
  - README.rdoc
146
- files:
147
- - .document
148
- - .rspec
214
+ files:
149
215
  - Gemfile
150
- - Gemfile.lock
151
216
  - LICENSE.txt
152
217
  - README.rdoc
153
218
  - Rakefile
@@ -166,69 +231,29 @@ files:
166
231
  - lib/checkdin/votes.rb
167
232
  - lib/checkdin/clients.rb
168
233
  - lib/checkdin/won_rewards.rb
169
- - spec/checkdin/activities_spec.rb
170
- - spec/checkdin/campaigns_spec.rb
171
- - spec/checkdin/client_spec.rb
172
- - spec/checkdin/custom_activities_spec.rb
173
- - spec/checkdin/leaderboard_spec.rb
174
- - spec/checkdin/promotions_spec.rb
175
- - spec/checkdin/push_api_subscriptions_spec.rb
176
- - spec/checkdin/users_spec.rb
177
- - spec/checkdin/user_bridge_spec.rb
178
- - spec/checkdin/won_rewards_spec.rb
179
- - spec/checkdin/clients_spec.rb
180
- - spec/fixtures/vcr_cassettes/Checkdin_Activities/viewing_a_list_of_activities.yml
181
- - spec/fixtures/vcr_cassettes/Checkdin_Activities/viewing_a_single_activity.yml
182
- - spec/fixtures/vcr_cassettes/Checkdin_Activities/voting_for_an_activity.yml
183
- - spec/fixtures/vcr_cassettes/Checkdin_Activities/voting_for_an_activity/passing_an_email.yml
184
- - spec/fixtures/vcr_cassettes/Checkdin_Campaigns/viewing_a_list_of_campaigns.yml
185
- - spec/fixtures/vcr_cassettes/Checkdin_Campaigns/viewing_a_single_campaign.yml
186
- - spec/fixtures/vcr_cassettes/Checkdin_CustomActivities.yml
187
- - spec/fixtures/vcr_cassettes/Checkdin_Leaderboard/viewing_a_leaderboard_for_a_campaign.yml
188
- - spec/fixtures/vcr_cassettes/Checkdin_Leaderboard/viewing_a_leaderboard_for_a_campaign_s_classifications.yml
189
- - spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_a_list_of_promotions.yml
190
- - spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_a_single_promotion.yml
191
- - spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_the_votes_leaderboard_for_a_promotion.yml
192
- - spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_the_votes_leaderboard_for_a_promotion/limiting_the_number_of_records_returned.yml
193
- - spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/disabling_a_push_api_subscription.yml
194
- - spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/enabling_a_push_api_subscription.yml
195
- - spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/viewing_a_list_of_push_api_subscriptions.yml
196
- - spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/viewing_a_single_push_api_subscription.yml
197
- - spec/fixtures/vcr_cassettes/Checkdin_Users/viewing_a_list_of_users.yml
198
- - spec/fixtures/vcr_cassettes/Checkdin_Users/viewing_a_single_user.yml
199
- - spec/fixtures/vcr_cassettes/Checkdin_Votes/filtering_by_a_single_user.yml
200
- - spec/fixtures/vcr_cassettes/Checkdin_Votes/viewing_a_list_of_activities.yml
201
- - spec/fixtures/vcr_cassettes/Checkdin_WonRewards/viewing_a_list_of_won_rewards.yml
202
- - spec/fixtures/vcr_cassettes/Checkdin_WonRewards/viewing_a_single_won_reward.yml
203
- - spec/fixtures/vcr_cassettes/Checkdin_Clients/viewing_a_client_s_own_information.yml
204
- - spec/spec_helper.rb
205
- has_rdoc: true
206
234
  homepage: http://github.com/mattmueller/checkdin
207
- licenses:
235
+ licenses:
208
236
  - MIT
209
237
  post_install_message:
210
238
  rdoc_options: []
211
-
212
- require_paths:
239
+ require_paths:
213
240
  - lib
214
- required_ruby_version: !ruby/object:Gem::Requirement
241
+ required_ruby_version: !ruby/object:Gem::Requirement
215
242
  none: false
216
- requirements:
217
- - - ">="
218
- - !ruby/object:Gem::Version
219
- version: "0"
220
- required_rubygems_version: !ruby/object:Gem::Requirement
243
+ requirements:
244
+ - - ! '>='
245
+ - !ruby/object:Gem::Version
246
+ version: '0'
247
+ required_rubygems_version: !ruby/object:Gem::Requirement
221
248
  none: false
222
- requirements:
223
- - - ">="
224
- - !ruby/object:Gem::Version
225
- version: "0"
249
+ requirements:
250
+ - - ! '>='
251
+ - !ruby/object:Gem::Version
252
+ version: '0'
226
253
  requirements: []
227
-
228
254
  rubyforge_project:
229
- rubygems_version: 1.6.2
255
+ rubygems_version: 1.8.24
230
256
  signing_key:
231
257
  specification_version: 3
232
258
  summary: Ruby gem for interacting with the checkd.in API.
233
259
  test_files: []
234
-
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/Gemfile.lock DELETED
@@ -1,59 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- checkdin (0.2.8)
5
- activesupport (>= 2.0.3)
6
- faraday (~> 0.8)
7
- faraday_middleware
8
- hashie (~> 1.0)
9
-
10
- GEM
11
- remote: http://rubygems.org/
12
- specs:
13
- activesupport (3.2.2)
14
- i18n (~> 0.6)
15
- multi_json (~> 1.0)
16
- addressable (2.2.7)
17
- crack (0.3.1)
18
- diff-lcs (1.1.3)
19
- faraday (0.8.0)
20
- multipart-post (~> 1.1)
21
- faraday_middleware (0.8.4)
22
- faraday (>= 0.7.4, < 0.9)
23
- hashie (1.2.0)
24
- i18n (0.6.0)
25
- json (1.6.5)
26
- multi_json (1.0.4)
27
- multipart-post (1.1.5)
28
- rdoc (3.12)
29
- json (~> 1.4)
30
- rspec (2.8.0)
31
- rspec-core (~> 2.8.0)
32
- rspec-expectations (~> 2.8.0)
33
- rspec-mocks (~> 2.8.0)
34
- rspec-core (2.8.0)
35
- rspec-expectations (2.8.0)
36
- diff-lcs (~> 1.1.2)
37
- rspec-mocks (2.8.0)
38
- simplecov (0.5.4)
39
- multi_json (~> 1.0.3)
40
- simplecov-html (~> 0.5.3)
41
- simplecov-html (0.5.3)
42
- timecop (0.3.5)
43
- vcr (1.11.3)
44
- webmock (1.7.10)
45
- addressable (~> 2.2, > 2.2.5)
46
- crack (>= 0.1.7)
47
-
48
- PLATFORMS
49
- ruby
50
-
51
- DEPENDENCIES
52
- bundler (~> 1.0)
53
- checkdin!
54
- rdoc (~> 3.12)
55
- rspec (~> 2.8.0)
56
- simplecov (~> 0.5.4)
57
- timecop
58
- vcr (~> 1.11.3)
59
- webmock (~> 1.7.10)
@@ -1,72 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Checkdin::Activities do
4
-
5
- before do
6
- @client = Checkdin::Client.new(TestCredentials.client_args)
7
- end
8
-
9
- context "viewing a single activity" do
10
- use_vcr_cassette
11
- let(:result) { @client.activity(236) }
12
-
13
- it "should make the activity's information available" do
14
- result.activity.type.should == "lbs_checkin"
15
- end
16
-
17
- it "should make the activity's acted on information available" do
18
- result.activity.acted_on.type.should == "place"
19
- result.activity.acted_on.name.should == "My Shop"
20
- end
21
-
22
- it "should include the user for the activity" do
23
- result.activity.user.username.should == "krhoch"
24
- end
25
- end
26
-
27
- context "viewing a list of activities" do
28
- use_vcr_cassette
29
- let(:result) { @client.activities(:limit => 2) }
30
-
31
- it "should make a list of activities available" do
32
- activities_types = result.activities.collect{|a| a.activity.type}
33
- activities_types.should == ["lbs_checkin","lbs_checkin"]
34
- end
35
-
36
- it "should only return the right number of results" do
37
- result.activities.count.should == 2
38
- end
39
-
40
- it "should return the users" do
41
- activity_user_usernames = result.activities.collect{|a| a.activity.user.username }
42
- activity_user_usernames.should == ["krhoch", "krhoch"]
43
- end
44
-
45
- end
46
-
47
- context "voting for an activity" do
48
- use_vcr_cassette
49
- let(:result) { @client.add_vote_on_activity(18881) }
50
-
51
- it "should make the activity's information available" do
52
- result.activity.type.should == "twitter_status"
53
- end
54
-
55
- it "should register the vote" do
56
- result.activity.vote_count.should == 6
57
- end
58
-
59
- context "passing an email" do
60
- use_vcr_cassette
61
- let(:result) { @client.add_vote_on_activity(18881, :user_id => 36)}
62
-
63
- it "should register the vote as normal" do
64
- result.activity.type.should == "twitter_status"
65
- end
66
-
67
- it "should up the vote count as normal" do
68
- result.activity.vote_count.should == 7
69
- end
70
- end
71
- end
72
- end
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Checkdin::Campaigns do
4
-
5
- before do
6
- @client = Checkdin::Client.new(TestCredentials.client_args)
7
- end
8
-
9
- context "viewing a single campaign" do
10
- use_vcr_cassette
11
- let(:result) { @client.campaign(2) }
12
-
13
- it "should make the campaign's information available" do
14
- result.campaign.name.should == "Check In To Win!"
15
- end
16
-
17
- it "should make the campaign's promotions available" do
18
- result.campaign.promotions.count.should == 1
19
- result.campaign.promotions.first.promotion.title.should == "Get a FREE coffee for every 5 check ins!"
20
- end
21
- end
22
-
23
- context "viewing a list of campaigns" do
24
- use_vcr_cassette
25
- let(:result) { @client.campaigns }
26
-
27
- it "should make a list of campaigns available" do
28
- result.count.should == 1
29
- result.first.campaign.name.should == "Check In To Win!"
30
- end
31
- end
32
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Checkdin::Client do
4
- context "creating a new instance" do
5
-
6
- it "should have a method for creating a new instance" do
7
- Checkdin::Client.respond_to?(:new).should be_true
8
- end
9
-
10
- it "should be a Checkdin::Client" do
11
- Checkdin::Client.new.should be_a(Checkdin::Client)
12
- end
13
-
14
- it "has the version available" do
15
- Checkdin::VERSION.should =~ /^\d\.\d\.\d/
16
- end
17
-
18
- it "takes an optional api_url" do
19
- instance = Checkdin::Client.new(:api_url => 'https://bogus.checkd.in/api/v7')
20
- instance.api_url.should == 'https://bogus.checkd.in/api/v7'
21
- end
22
-
23
- it "raises an error when an unknown option is passed" do
24
- expect {
25
- Checkdin::Client.new(:unexpected_present => 'details here')
26
- }.to raise_error(ArgumentError, /unexpected_present/)
27
- end
28
- end
29
- end
@@ -1,23 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Checkdin::Clients do
4
-
5
- before do
6
- @client = Checkdin::Client.new(TestCredentials.client_args)
7
- end
8
-
9
- context "viewing a client's own information" do
10
- use_vcr_cassette
11
- let(:result) { @client.client_details }
12
-
13
- it "should make the client's information available" do
14
- result.client.name.should == "A Test"
15
- result.client.website.should == "http://example.com"
16
- result.client.signup_redirect.should == "http://example.com/users/return_from_checkdin"
17
- result.client.custom_domain.should == "custom.staging.checkd.in"
18
- result.client.shared_authentication_secret.should == "12345"
19
- result.client.push_api_secret.should be_nil
20
- end
21
-
22
- end
23
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Checkdin::CustomActivities do
4
- use_vcr_cassette
5
-
6
- before do
7
- @client = Checkdin::Client.new(TestCredentials.client_args)
8
- end
9
-
10
- it "should report success when creating a custom activity" do
11
- @client.create_custom_activity(:email => 'muellermr@gmail.com', :custom_activity_node_id => 1).result.should == "success"
12
- end
13
- end