checkdin 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/checkdin/users.rb +42 -0
- data/lib/checkdin/version.rb +1 -1
- metadata +168 -143
- data/.document +0 -5
- data/.rspec +0 -1
- data/Gemfile.lock +0 -59
- data/spec/checkdin/activities_spec.rb +0 -72
- data/spec/checkdin/campaigns_spec.rb +0 -32
- data/spec/checkdin/client_spec.rb +0 -29
- data/spec/checkdin/clients_spec.rb +0 -23
- data/spec/checkdin/custom_activities_spec.rb +0 -13
- data/spec/checkdin/leaderboard_spec.rb +0 -28
- data/spec/checkdin/promotions_spec.rb +0 -63
- data/spec/checkdin/push_api_subscriptions_spec.rb +0 -50
- data/spec/checkdin/user_bridge_spec.rb +0 -148
- data/spec/checkdin/users_spec.rb +0 -109
- data/spec/checkdin/won_rewards_spec.rb +0 -45
- data/spec/fixtures/vcr_cassettes/Checkdin_Activities/viewing_a_list_of_activities.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Checkdin_Activities/viewing_a_single_activity.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Checkdin_Activities/voting_for_an_activity/passing_an_email.yml +0 -48
- data/spec/fixtures/vcr_cassettes/Checkdin_Activities/voting_for_an_activity.yml +0 -48
- data/spec/fixtures/vcr_cassettes/Checkdin_Campaigns/viewing_a_list_of_campaigns.yml +0 -43
- data/spec/fixtures/vcr_cassettes/Checkdin_Campaigns/viewing_a_single_campaign.yml +0 -51
- data/spec/fixtures/vcr_cassettes/Checkdin_Clients/viewing_a_client_s_own_information.yml +0 -46
- data/spec/fixtures/vcr_cassettes/Checkdin_CustomActivities.yml +0 -47
- data/spec/fixtures/vcr_cassettes/Checkdin_Leaderboard/viewing_a_leaderboard_for_a_campaign.yml +0 -42
- data/spec/fixtures/vcr_cassettes/Checkdin_Leaderboard/viewing_a_leaderboard_for_a_campaign_s_classifications.yml +0 -46
- data/spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_a_list_of_promotions.yml +0 -58
- data/spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_a_single_promotion.yml +0 -51
- data/spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_the_votes_leaderboard_for_a_promotion/limiting_the_number_of_records_returned.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Checkdin_Promotions/viewing_the_votes_leaderboard_for_a_promotion.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/disabling_a_push_api_subscription.yml +0 -32
- data/spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/enabling_a_push_api_subscription.yml +0 -32
- data/spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/viewing_a_list_of_push_api_subscriptions.yml +0 -32
- data/spec/fixtures/vcr_cassettes/Checkdin_PushApiSubscriptions/viewing_a_single_push_api_subscription.yml +0 -32
- data/spec/fixtures/vcr_cassettes/Checkdin_Users/viewing_a_list_of_users.yml +0 -42
- data/spec/fixtures/vcr_cassettes/Checkdin_Users/viewing_a_single_user.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Checkdin_Votes/filtering_by_a_single_user.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Checkdin_Votes/viewing_a_list_of_activities.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Checkdin_WonRewards/viewing_a_list_of_won_rewards.yml +0 -53
- data/spec/fixtures/vcr_cassettes/Checkdin_WonRewards/viewing_a_single_won_reward.yml +0 -49
- data/spec/spec_helper.rb +0 -49
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Checkdin::Leaderboard do
|
4
|
-
|
5
|
-
before do
|
6
|
-
@client = Checkdin::Client.new(TestCredentials.client_args)
|
7
|
-
end
|
8
|
-
|
9
|
-
context "viewing a leaderboard for a campaign" do
|
10
|
-
use_vcr_cassette
|
11
|
-
let(:result) { @client.leaderboard(2, :limit => 5) }
|
12
|
-
|
13
|
-
it "should provide a list of users" do
|
14
|
-
result.leaders.first.leader.username.should == "hshapley"
|
15
|
-
result.leaders.count.should == 5
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context "viewing a leaderboard for a campaign's classifications" do
|
20
|
-
use_vcr_cassette
|
21
|
-
let(:result) { @client.classification_leaderboard(35) }
|
22
|
-
|
23
|
-
it "should provide a list of classifications" do
|
24
|
-
result.classifications.first.classification.should == "grouped"
|
25
|
-
result.classifications.first.total_points.should == 10
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Checkdin::Promotions do
|
4
|
-
|
5
|
-
before do
|
6
|
-
@client = Checkdin::Client.new(TestCredentials.client_args)
|
7
|
-
end
|
8
|
-
|
9
|
-
context "viewing a single promotion" do
|
10
|
-
use_vcr_cassette
|
11
|
-
let(:result) { @client.promotion(8) }
|
12
|
-
|
13
|
-
it "should make the promotion's information available" do
|
14
|
-
result.promotion.title.should == "Get a FREE coffee for every 5 check ins!"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should make the promotion's campaign available" do
|
18
|
-
result.promotion.campaign.name.should == "Check In To Win"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "viewing a list of promotions" do
|
23
|
-
use_vcr_cassette
|
24
|
-
let(:result) { @client.promotions(:limit => 2) }
|
25
|
-
|
26
|
-
it "should make a list of promotion info available" do
|
27
|
-
promotion_names = result.promotions.collect{|p| p.promotion.title}
|
28
|
-
promotion_names.should == ["Get a FREE coffee for every 5 check ins!","Check in and get breakfast for 99 cents!"]
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should only return the right number of results" do
|
32
|
-
result.count.should == 2
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context "viewing the votes leaderboard for a promotion" do
|
37
|
-
use_vcr_cassette
|
38
|
-
let(:result) { @client.promotion_votes_leaderboard(54, :limit => limit) }
|
39
|
-
let(:limit) { nil }
|
40
|
-
|
41
|
-
it "should return promotion information" do
|
42
|
-
result.promotion.title.should == "A voting promotion!"
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should return a list of activities ordered by vote count" do
|
46
|
-
result.promotion.votes_leaderboard.activities.first.activity.vote_count.should == 7
|
47
|
-
result.promotion.votes_leaderboard.activities.last.activity.vote_count.should == 0
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should return all activities" do
|
51
|
-
result.promotion.votes_leaderboard.activities.count.should == 3
|
52
|
-
end
|
53
|
-
|
54
|
-
context "limiting the number of records returned" do
|
55
|
-
use_vcr_cassette
|
56
|
-
let(:limit) { 1 }
|
57
|
-
|
58
|
-
it "should only return limit number of records" do
|
59
|
-
result.promotion.votes_leaderboard.activities.count.should == 1
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Checkdin::PushApiSubscriptions do
|
4
|
-
|
5
|
-
before do
|
6
|
-
@client = Checkdin::Client.new(TestCredentials.client_args)
|
7
|
-
end
|
8
|
-
|
9
|
-
context "viewing a single push api subscription" do
|
10
|
-
use_vcr_cassette
|
11
|
-
let(:result) { @client.push_api_subscription(1) }
|
12
|
-
|
13
|
-
it "should make the push API subscription's url available" do
|
14
|
-
result.push_api_subscription.push_url.should == "http://test.com"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should make the push API subscription's push secret available" do
|
18
|
-
result.push_api_subscription.secret.should == "6dec79a3034468c530fc"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "viewing a list of push api subscriptions" do
|
23
|
-
use_vcr_cassette
|
24
|
-
let(:result) { @client.push_api_subscriptions }
|
25
|
-
|
26
|
-
it "should make a list of push API subscriptions available" do
|
27
|
-
result.count.should == 2
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context "enabling a push api subscription" do
|
32
|
-
use_vcr_cassette
|
33
|
-
let(:result) { @client.enable_push_api_subscription(2) }
|
34
|
-
|
35
|
-
it "should enable the subscription and return it" do
|
36
|
-
result.push_api_subscription.state.should == "enabled"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context "disabling a push api subscription" do
|
41
|
-
use_vcr_cassette
|
42
|
-
let(:result) { @client.disable_push_api_subscription(1) }
|
43
|
-
|
44
|
-
it "should disable the subscription and return it" do
|
45
|
-
result.push_api_subscription.state.should == "disabled"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
end
|
@@ -1,148 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'timecop'
|
3
|
-
|
4
|
-
describe Checkdin::UserBridge, 'constructor' do
|
5
|
-
let(:default_options) {{
|
6
|
-
:client_identifier => 'my-client',
|
7
|
-
:bridge_secret => 'never-tell-123'
|
8
|
-
}}
|
9
|
-
|
10
|
-
it "can be instantiated with identifier and bridge secret" do
|
11
|
-
instance = Checkdin::UserBridge.new(default_options)
|
12
|
-
instance.client_identifier.should == 'my-client'
|
13
|
-
instance.bridge_secret.should == 'never-tell-123'
|
14
|
-
end
|
15
|
-
|
16
|
-
it "has a usable default checkdin_landing_url" do
|
17
|
-
instance = Checkdin::UserBridge.new(default_options)
|
18
|
-
instance.checkdin_landing_url.should == 'https://app.checkd.in/user_landing?'
|
19
|
-
end
|
20
|
-
|
21
|
-
it "can optionally set the checkdin_landing_url directly" do
|
22
|
-
landing_url = stub('land here')
|
23
|
-
instance = Checkdin::UserBridge.new(default_options.merge(:checkdin_landing_url => landing_url))
|
24
|
-
instance.checkdin_landing_url.should == landing_url
|
25
|
-
end
|
26
|
-
|
27
|
-
it "does not raise an error on unknown arguments" do
|
28
|
-
expect do
|
29
|
-
Checkdin::UserBridge.new(default_options.merge(:misspelled_option => 'error me'))
|
30
|
-
end.to_not raise_error(ArgumentError, /misspelled_option/)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe Checkdin::UserBridge, '#login_url' do
|
35
|
-
let(:instance) { Checkdin::UserBridge.new(:client_identifier => client_identifier,
|
36
|
-
:bridge_secret => bridge_secret,
|
37
|
-
:checkdin_landing_url => checkdin_landing_url) }
|
38
|
-
subject { instance.login_url(options) }
|
39
|
-
let(:options) { default_options }
|
40
|
-
let(:default_options) {{
|
41
|
-
:email => user_email,
|
42
|
-
:user_identifier => user_identifier
|
43
|
-
}}
|
44
|
-
let(:client_identifier) { 'client-1704' }
|
45
|
-
let(:bridge_secret) { '123-shared-secret' }
|
46
|
-
let(:user_email) { 'bob@example.com' }
|
47
|
-
let(:user_identifier) { '17-batch1-bob' }
|
48
|
-
let(:checkdin_landing_url) { nil }
|
49
|
-
let(:timestamp) { 1325605589 }
|
50
|
-
|
51
|
-
context "no custom domain set" do
|
52
|
-
it "should output a url for app.checkd.in using https" do
|
53
|
-
subject.should =~ /^https:\/\/app\.checkd\.in/
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should include the correct timestamp" do
|
57
|
-
Timecop.freeze(Time.at(timestamp)) do
|
58
|
-
subject.should include('auth_timestamp=1325605589')
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
it "returns a fully usable result" do
|
63
|
-
Timecop.freeze(Time.at(timestamp)) do
|
64
|
-
subject.should == "https://app.checkd.in/user_landing?auth_timestamp=1325605589&client_id=client-1704&client_uid=17-batch1-bob&digest=2ca9aca03aa115495e7ce50c941e0efce6e8aeb11480cde04fd1b03110c174ff&email=bob%40example.com"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context "with an optional action set" do
|
69
|
-
let(:options) { default_options.merge(:authentication_action => 'authenticate_facebook') }
|
70
|
-
|
71
|
-
it "includes the authentication_action" do
|
72
|
-
Timecop.freeze(Time.at(timestamp)) do
|
73
|
-
subject.should == "https://app.checkd.in/user_landing?auth_timestamp=1325605589&authentication_action=authenticate_facebook&client_id=client-1704&client_uid=17-batch1-bob&digest=f27f0b46e8fb383f53e48d02da51be05f573d4aa80d727acfe08d2cc76db2861&email=bob%40example.com"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
context "with additional attributes set" do
|
79
|
-
let(:options) { default_options.merge(:delivery_email => false) }
|
80
|
-
|
81
|
-
it "includes the additional attriubtes" do
|
82
|
-
Timecop.freeze(Time.at(timestamp)) do
|
83
|
-
subject.should == "https://app.checkd.in/user_landing?auth_timestamp=1325605589&client_id=client-1704&client_uid=17-batch1-bob&delivery_email=false&digest=f3950bee05fb1ca97727d9c190f2b30cfbdcf74a7150b3c337afbfc557d988dc&email=bob%40example.com"
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
context "custom subdomain" do
|
90
|
-
let(:checkdin_landing_url) { 'https://grace.checkd.in/user_landing?' }
|
91
|
-
it "uses it" do
|
92
|
-
Timecop.freeze(Time.at(timestamp)) do
|
93
|
-
subject.should == "https://grace.checkd.in/user_landing?auth_timestamp=1325605589&client_id=client-1704&client_uid=17-batch1-bob&digest=2ca9aca03aa115495e7ce50c941e0efce6e8aeb11480cde04fd1b03110c174ff&email=bob%40example.com"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
context "custom domain" do
|
99
|
-
let(:checkdin_landing_url) { 'http://checkin.example.com/my_landing?' }
|
100
|
-
it "uses it" do
|
101
|
-
Timecop.freeze(Time.at(timestamp)) do
|
102
|
-
subject.should == "http://checkin.example.com/my_landing?auth_timestamp=1325605589&client_id=client-1704&client_uid=17-batch1-bob&digest=2ca9aca03aa115495e7ce50c941e0efce6e8aeb11480cde04fd1b03110c174ff&email=bob%40example.com"
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
describe Checkdin::UserBridge, '#build_authenticated_parameters' do
|
109
|
-
let(:instance) { Checkdin::UserBridge.new(:client_identifier => client_identifier, :bridge_secret => bridge_secret) }
|
110
|
-
subject { instance.build_authenticated_parameters(user_email, user_identifier, options) }
|
111
|
-
let(:options) { {} }
|
112
|
-
let(:client_identifier) { 'client-1704' }
|
113
|
-
let(:bridge_secret) { '123-shared-secret' }
|
114
|
-
let(:user_email) { 'bob@example.com' }
|
115
|
-
let(:user_identifier) { '17-batch1-bob' }
|
116
|
-
let(:timestamp) { 1325605589 }
|
117
|
-
|
118
|
-
it "should output a hash with timestamp and digest included" do
|
119
|
-
Timecop.freeze(Time.at(timestamp)) do
|
120
|
-
subject.should == {
|
121
|
-
'auth_timestamp' => timestamp,
|
122
|
-
'client_id' => client_identifier,
|
123
|
-
'client_uid' => user_identifier,
|
124
|
-
'email' => user_email,
|
125
|
-
'digest' => '2ca9aca03aa115495e7ce50c941e0efce6e8aeb11480cde04fd1b03110c174ff'
|
126
|
-
}
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
context "with an authenticated action in the options" do
|
131
|
-
subject { instance.build_authenticated_parameters(user_email, user_identifier, options) }
|
132
|
-
let(:options) { {:authentication_action => 'authenticate_facebook'} }
|
133
|
-
|
134
|
-
it "should output a hash with a different digest and the authenticated_action included" do
|
135
|
-
Timecop.freeze(Time.at(timestamp)) do
|
136
|
-
subject.should == {
|
137
|
-
'auth_timestamp' => timestamp,
|
138
|
-
'authentication_action' => 'authenticate_facebook',
|
139
|
-
'client_id' => client_identifier,
|
140
|
-
'client_uid' => user_identifier,
|
141
|
-
'email' => user_email,
|
142
|
-
'digest' => 'f27f0b46e8fb383f53e48d02da51be05f573d4aa80d727acfe08d2cc76db2861'
|
143
|
-
}
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
end
|
data/spec/checkdin/users_spec.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Checkdin::Users do
|
4
|
-
|
5
|
-
before do
|
6
|
-
@client = Checkdin::Client.new(TestCredentials.client_args)
|
7
|
-
end
|
8
|
-
|
9
|
-
context "viewing a single user" do
|
10
|
-
use_vcr_cassette
|
11
|
-
let(:result) { @client.user(187) }
|
12
|
-
|
13
|
-
it "should make the user's information available" do
|
14
|
-
result.user.username.should == "krhoch"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should include the authentications for the user" do
|
18
|
-
result.user.authentications.count.should == 1
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "viewing a list of users" do
|
23
|
-
use_vcr_cassette
|
24
|
-
let(:result) { @client.users(:limit => 2) }
|
25
|
-
|
26
|
-
it "should make a list of users available" do
|
27
|
-
user_usernames = result.users.collect{|u| u.user.username}
|
28
|
-
user_usernames.should == ["jclandes","krhoch"]
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should only return the right number of results" do
|
32
|
-
result.users.count.should == 2
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
context "creating a user" do
|
38
|
-
|
39
|
-
context "with valid parameters" do
|
40
|
-
use_vcr_cassette
|
41
|
-
let(:result) { @client.create_user(:email => 'atest@checkd.in', :identifier => 'clientuid123')}
|
42
|
-
|
43
|
-
it "should return the new user's basic information" do
|
44
|
-
result.user.should_not be_nil
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context "with an invalid email" do
|
49
|
-
use_vcr_cassette
|
50
|
-
|
51
|
-
it "should return error 400" do
|
52
|
-
expect do
|
53
|
-
@client.create_user(:email => 'notanemail', :identifier => 'client123')
|
54
|
-
end.to raise_error(Checkdin::APIError, /400/)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context "viewing a single user's list of authentications" do
|
60
|
-
use_vcr_cassette
|
61
|
-
let(:result) { @client.user_authentications(7835) }
|
62
|
-
|
63
|
-
it "should make a list of authentications available" do
|
64
|
-
result.authentications.collect{ |a| a.authentication.provider }.should == ["twitter","facebook","foursquare"]
|
65
|
-
end
|
66
|
-
|
67
|
-
it "should include the user's uid" do
|
68
|
-
result.authentications.collect{ |a| a.authentication.uid }.should == ["5930881311","1000038776937901","19125491"]
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
context "viewing a single user's specific authentication" do
|
73
|
-
use_vcr_cassette
|
74
|
-
let(:result) { @client.user_authentication(7835, 19479) }
|
75
|
-
|
76
|
-
it "should make a single authentication available" do
|
77
|
-
result.authentication.provider.should == "twitter"
|
78
|
-
result.authentication.uid.should == "5930881311"
|
79
|
-
result.authentication.nickname.should == "demo"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context "creating an authentication" do
|
84
|
-
context "with valid parameters" do
|
85
|
-
use_vcr_cassette
|
86
|
-
let(:result) { @client.create_user_authentication(7887,
|
87
|
-
:provider => "foursquare",
|
88
|
-
:uid => "1234",
|
89
|
-
:oauth_token => "111",
|
90
|
-
:nickname => "foursquare_name") }
|
91
|
-
|
92
|
-
it "should return the new authentication's information" do
|
93
|
-
result.authentication.provider.should == "foursquare"
|
94
|
-
result.authentication.uid.should == "1234"
|
95
|
-
result.authentication.nickname.should == "foursquare_name"
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
context "with invalid parameters" do
|
100
|
-
use_vcr_cassette
|
101
|
-
|
102
|
-
it "should return an error 400" do
|
103
|
-
expect do
|
104
|
-
@client.create_user_authentication(7887)
|
105
|
-
end.to raise_error(Checkdin::APIError, /400/)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Checkdin::WonRewards do
|
4
|
-
|
5
|
-
before do
|
6
|
-
@client = Checkdin::Client.new(TestCredentials.client_args)
|
7
|
-
end
|
8
|
-
|
9
|
-
context "viewing a single won reward" do
|
10
|
-
use_vcr_cassette
|
11
|
-
let(:result) { @client.won_reward(142) }
|
12
|
-
|
13
|
-
it "should make the won rewards' information available" do
|
14
|
-
result.won_reward.private_delivery_description.should == "Thank you"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should make the won rewards' promotion available" do
|
18
|
-
result.won_reward.promotion.title.should == "A great promotion"
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should include the user for the won reward" do
|
22
|
-
result.won_reward.user.username.should == "bdoyk"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
context "viewing a list of won rewards" do
|
27
|
-
use_vcr_cassette
|
28
|
-
let(:result) { @client.won_rewards(:limit => 2) }
|
29
|
-
|
30
|
-
it "should make a list of won rewards available" do
|
31
|
-
won_reward_delivery_descriptions = result.won_rewards.collect{|wr| wr.won_reward.private_delivery_description}
|
32
|
-
won_reward_delivery_descriptions.should == ["Thank you","Thank you"]
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should only return the right number of results" do
|
36
|
-
result.count.should == 2
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should return the users" do
|
40
|
-
won_reward_user_usernames = result.won_rewards.collect{|wr| wr.won_reward.user.username }
|
41
|
-
won_reward_user_usernames.should == ["bdoyk", "krhoch"]
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
4
|
-
method: :get
|
5
|
-
uri: https://app.checkd.in:443/api/v1/activities?client_id={client_id}&client_secret={client_secret}&limit=2
|
6
|
-
body: !!null
|
7
|
-
headers:
|
8
|
-
accept:
|
9
|
-
- application/json
|
10
|
-
user-agent:
|
11
|
-
- Ruby gem
|
12
|
-
accept-encoding:
|
13
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
-
response: !ruby/struct:VCR::Response
|
15
|
-
status: !ruby/struct:VCR::ResponseStatus
|
16
|
-
code: 200
|
17
|
-
message: OK
|
18
|
-
headers:
|
19
|
-
server:
|
20
|
-
- nginx/0.8.54
|
21
|
-
date:
|
22
|
-
- Tue, 14 Feb 2012 18:52:42 GMT
|
23
|
-
content-type:
|
24
|
-
- application/json; charset=utf-8
|
25
|
-
transfer-encoding:
|
26
|
-
- chunked
|
27
|
-
connection:
|
28
|
-
- keep-alive
|
29
|
-
strict-transport-security:
|
30
|
-
- max-age=31536000
|
31
|
-
x-ua-compatible:
|
32
|
-
- IE=Edge,chrome=1
|
33
|
-
etag:
|
34
|
-
- ! '"68f9c440dfd3a3e933b876073f1f4194"'
|
35
|
-
cache-control:
|
36
|
-
- max-age=0, private, must-revalidate
|
37
|
-
x-runtime:
|
38
|
-
- '0.114258'
|
39
|
-
x-rack-cache:
|
40
|
-
- miss
|
41
|
-
body: ! '{"total_pages":104,"activities":[{"activity":{"type":"lbs_checkin","created_at":"2012-02-11T10:27:21-06:00","acted_on":{"type":"place","message":null,"name":"My Shop","address":"1500 21st Ave S","city":"Nashville","state":"TN","zip":"37212","latitude":36.1395781,"longitude":-86.800412,"phone":"","open_hours":""},"user":{"id":187,"username":"krhoch","avatar_url":"https://prod-checkdin-user.s3.amazonaws.com/uploads/187/ROPQUJ0DZBN00OQB.jpg","href":"https://app.checkd.in/api/v1/activities.json?user_id=187"},"href":"https://app.checkd.in/api/v1/activities/237.json"}},{"activity":{"type":"lbs_checkin","created_at":"2012-02-11T10:27:21-06:00","acted_on":{"type":"place","message":null,"name":"My Shop","address":"1500 21st Ave S","city":"Nashville","state":"TN","zip":"37212","latitude":36.1395781,"longitude":-86.800412,"phone":"","open_hours":""},"user":{"id":187,"username":"krhoch","avatar_url":"https://prod-checkdin-user.s3.amazonaws.com/uploads/187/ROPQUJ0DZBN00OQB.jpg","href":"https://app.checkd.in/api/v1/activities.json?user_id=187"},"href":"https://app.checkd.in/api/v1/activities/236.json"}}]}
|
42
|
-
|
43
|
-
'
|
44
|
-
http_version: '1.1'
|
@@ -1,44 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
4
|
-
method: :get
|
5
|
-
uri: https://app.checkd.in:443/api/v1/activities/236?client_id={client_id}&client_secret={client_secret}
|
6
|
-
body: !!null
|
7
|
-
headers:
|
8
|
-
accept:
|
9
|
-
- application/json
|
10
|
-
user-agent:
|
11
|
-
- Ruby gem
|
12
|
-
accept-encoding:
|
13
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
-
response: !ruby/struct:VCR::Response
|
15
|
-
status: !ruby/struct:VCR::ResponseStatus
|
16
|
-
code: 200
|
17
|
-
message: OK
|
18
|
-
headers:
|
19
|
-
server:
|
20
|
-
- nginx/0.8.54
|
21
|
-
date:
|
22
|
-
- Tue, 14 Feb 2012 18:52:42 GMT
|
23
|
-
content-type:
|
24
|
-
- application/json; charset=utf-8
|
25
|
-
transfer-encoding:
|
26
|
-
- chunked
|
27
|
-
connection:
|
28
|
-
- keep-alive
|
29
|
-
strict-transport-security:
|
30
|
-
- max-age=31536000
|
31
|
-
x-ua-compatible:
|
32
|
-
- IE=Edge,chrome=1
|
33
|
-
etag:
|
34
|
-
- ! '"fc26ef7c31c135517f6f6e560296f890"'
|
35
|
-
cache-control:
|
36
|
-
- max-age=0, private, must-revalidate
|
37
|
-
x-runtime:
|
38
|
-
- '0.032465'
|
39
|
-
x-rack-cache:
|
40
|
-
- miss
|
41
|
-
body: ! '{"activity":{"type":"lbs_checkin","created_at":"2012-02-11T10:27:21-06:00","acted_on":{"type":"place","message":null,"name":"My Shop","address":"1500 21st Ave S","city":"Nashville","state":"TN","zip":"37212","latitude":36.1395781,"longitude":-86.800412,"phone":"","open_hours":""},"user":{"id":187,"username":"krhoch","avatar_url":"https://prod-checkdin-user.s3.amazonaws.com/uploads/187/ROPQUJ0DZBN00OQB.jpg","href":"https://app.checkd.in/api/v1/activities.json?user_id=187"}}}
|
42
|
-
|
43
|
-
'
|
44
|
-
http_version: '1.1'
|
data/spec/fixtures/vcr_cassettes/Checkdin_Activities/voting_for_an_activity/passing_an_email.yml
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
4
|
-
method: :post
|
5
|
-
uri: https://app.checkd.in:443/api/v1/activities/18881/vote?client_id={client_id}&client_secret={client_secret}&user_id=36
|
6
|
-
body:
|
7
|
-
headers:
|
8
|
-
accept:
|
9
|
-
- application/json
|
10
|
-
user-agent:
|
11
|
-
- checkdin ruby gem 0.2.1
|
12
|
-
content-length:
|
13
|
-
- "0"
|
14
|
-
response: !ruby/struct:VCR::Response
|
15
|
-
status: !ruby/struct:VCR::ResponseStatus
|
16
|
-
code: 200
|
17
|
-
message: OK
|
18
|
-
headers:
|
19
|
-
server:
|
20
|
-
- nginx/1.0.11
|
21
|
-
date:
|
22
|
-
- Mon, 09 Apr 2012 10:42:37 GMT
|
23
|
-
content-type:
|
24
|
-
- application/json; charset=utf-8
|
25
|
-
transfer-encoding:
|
26
|
-
- chunked
|
27
|
-
connection:
|
28
|
-
- keep-alive
|
29
|
-
status:
|
30
|
-
- 200 OK
|
31
|
-
strict-transport-security:
|
32
|
-
- max-age=31536000
|
33
|
-
x-ua-compatible:
|
34
|
-
- IE=Edge,chrome=1
|
35
|
-
etag:
|
36
|
-
- "\"22ee544aa801964a479d745eb9bdba07\""
|
37
|
-
cache-control:
|
38
|
-
- max-age=0, private, must-revalidate
|
39
|
-
set-cookie:
|
40
|
-
- _checkdin_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJTYyNjY0NTlhMThkZmFjNTJlMzcwMTA4NTc0OThiMWZlBjsAVA%3D%3D--c70adeb132862f669fc85fc8e5e643ea2b811b57; domain=app.checkd.in; path=/; HttpOnly; secure
|
41
|
-
x-runtime:
|
42
|
-
- "0.03{client_secret}"
|
43
|
-
x-rack-cache:
|
44
|
-
- invalidate, pass
|
45
|
-
body: |
|
46
|
-
{"activity":{"type":"twitter_status","id":18881,"created_at":"2012-02-21T16:08:55-06:00","acted_on":{"type":"twitter_status","tweet_fk":172080368760000512,"status":"Check out what I purchased at #mynordstrom http://t.co/DKUXa41E","photo_url":"https://p.twimg.com/AmNaLwUCEAIt1v3.jpg","photo_thumbnail_url":"https://p.twimg.com/AmNaLwUCEAIt1v3.jpg:thumb"},"user":{"id":36,"username":"demomattloadtest","avatar_url":null,"href":"https://app.checkd.in/api/v1/activities.json?user_id=36"},"vote_count":7}}
|
47
|
-
|
48
|
-
http_version: "1.1"
|
@@ -1,48 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
4
|
-
method: :post
|
5
|
-
uri: https://app.checkd.in:443/api/v1/activities/18881/vote?client_id={client_id}&client_secret={client_secret}
|
6
|
-
body:
|
7
|
-
headers:
|
8
|
-
accept:
|
9
|
-
- application/json
|
10
|
-
user-agent:
|
11
|
-
- checkdin ruby gem 0.2.1
|
12
|
-
content-length:
|
13
|
-
- "0"
|
14
|
-
response: !ruby/struct:VCR::Response
|
15
|
-
status: !ruby/struct:VCR::ResponseStatus
|
16
|
-
code: 200
|
17
|
-
message: OK
|
18
|
-
headers:
|
19
|
-
server:
|
20
|
-
- nginx/1.0.11
|
21
|
-
date:
|
22
|
-
- Mon, 09 Apr 2012 10:38:50 GMT
|
23
|
-
content-type:
|
24
|
-
- application/json; charset=utf-8
|
25
|
-
transfer-encoding:
|
26
|
-
- chunked
|
27
|
-
connection:
|
28
|
-
- keep-alive
|
29
|
-
status:
|
30
|
-
- 200 OK
|
31
|
-
strict-transport-security:
|
32
|
-
- max-age=31536000
|
33
|
-
x-ua-compatible:
|
34
|
-
- IE=Edge,chrome=1
|
35
|
-
etag:
|
36
|
-
- "\"78c7474e01ca50b8cfc238ad7974fed1\""
|
37
|
-
cache-control:
|
38
|
-
- max-age=0, private, must-revalidate
|
39
|
-
set-cookie:
|
40
|
-
- _checkdin_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJWQ3MmVkYzllYzNhZWVhYmU4ZmQ2YjNlN2IxZjEyMjE2BjsAVA%3D%3D--8c08feb9944b93e628e7740a373d79e5adb6bd73; domain=app.checkd.in; path=/; HttpOnly; secure
|
41
|
-
x-runtime:
|
42
|
-
- "0.039170"
|
43
|
-
x-rack-cache:
|
44
|
-
- invalidate, pass
|
45
|
-
body: |
|
46
|
-
{"activity":{"type":"twitter_status","id":18881,"created_at":"2012-02-21T16:08:55-06:00","acted_on":{"type":"twitter_status","tweet_fk":172080368760000512,"status":"Check out what I purchased at #mynordstrom http://t.co/DKUXa41E","photo_url":"https://p.twimg.com/AmNaLwUCEAIt1v3.jpg","photo_thumbnail_url":"https://p.twimg.com/AmNaLwUCEAIt1v3.jpg:thumb"},"user":{"id":36,"username":"demomattloadtest","avatar_url":null,"href":"https://app.checkd.in/api/v1/activities.json?user_id=36"},"vote_count":6}}
|
47
|
-
|
48
|
-
http_version: "1.1"
|
@@ -1,43 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
4
|
-
method: :get
|
5
|
-
uri: https://app.checkd.in:443/api/v1/campaigns?client_id={client_id}&client_secret={client_secret}
|
6
|
-
body: !!null
|
7
|
-
headers:
|
8
|
-
accept:
|
9
|
-
- application/json
|
10
|
-
user-agent:
|
11
|
-
- Ruby gem
|
12
|
-
accept-encoding:
|
13
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
-
response: !ruby/struct:VCR::Response
|
15
|
-
status: !ruby/struct:VCR::ResponseStatus
|
16
|
-
code: 200
|
17
|
-
message: OK
|
18
|
-
headers:
|
19
|
-
server:
|
20
|
-
- nginx/0.8.54
|
21
|
-
date:
|
22
|
-
- Tue, 14 Feb 2012 16:50:30 GMT
|
23
|
-
content-type:
|
24
|
-
- application/json; charset=utf-8
|
25
|
-
transfer-encoding:
|
26
|
-
- chunked
|
27
|
-
connection:
|
28
|
-
- keep-alive
|
29
|
-
strict-transport-security:
|
30
|
-
- max-age=31536000
|
31
|
-
x-ua-compatible:
|
32
|
-
- IE=Edge,chrome=1
|
33
|
-
etag:
|
34
|
-
- ! '"e6f7707236ce6deee928389ed07c85bf"'
|
35
|
-
cache-control:
|
36
|
-
- max-age=0, private, must-revalidate
|
37
|
-
x-runtime:
|
38
|
-
- '0.041441'
|
39
|
-
x-rack-cache:
|
40
|
-
- miss
|
41
|
-
body: ! '[{"campaign":{"name":"Check In To Win!","description":"Check in
|
42
|
-
to win free coffee and more!","start_date":"2011-10-17","end_date":"2012-10-17","href":"https://app.checkd.in/api/v1/campaigns/2.json","promotions":{"count":3,"href":"https://app.checkd.in/api/v1/promotions.json?campaign_id=2"},"leaderboard":{"href":"https://app.checkd.in/api/v1/campaigns/2/leaderboard.json"}}}]'
|
43
|
-
http_version: '1.1'
|