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.
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
@@ -1,59 +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/users/187?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 19:09:21 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
- - ! '"cd8e76b1364d66de77c58ed78224a65e"'
35
- cache-control:
36
- - max-age=0, private, must-revalidate
37
- x-runtime:
38
- - '0.042271'
39
- x-rack-cache:
40
- - miss
41
- body: ! '{"user":{"id":187,"username":"krhoch","created_at":"2012-01-26T08:16:48-06:00","first_name":null,"last_name":null,"birth_date":"1986-05-29","gender":"male","authentications":[{"authentication":{"provider":"foursquare","token_state":"fresh"}}],"campaigns":[{"campaign":{"name":"Check
42
- In With ","description":"Check in with to win free coffee and
43
- more!","start_date":"2011-10-17","end_date":"2012-10-17","href":"https://app.checkd.in/api/v1/campaigns/2.json","points":0,"won_rewards":[{"won_reward":{"points_when_rewarded":null,"points_needed":null,"created_at":"2012-01-27T09:03:21-06:00","updated_at":"2012-01-27T09:03:21-06:00","promotion":{"title":"Check
44
- in and get breakfast for 99 cents!","description":"Check in at our new location
45
- at the downtown and receive a bagel with cream cheese
46
- or sausage biscuit for only 99 cents!","terms":"*Offer only applies at locations","above_21_only":false,"ends_at":"2012-10-16T07:51:32-05:00","href":"https://app.checkd.in/api/v1/promotions/7.json","type":"promotion_lbs_checkin","place_groups":[{"place_group":{"name":"Stores","href":"https://app.checkd.in/api/v1/place_groups/2.json"}}],"reward":{"private_delivery_description":"Thanks
47
- for checking-in with! You have earned your first discount
48
- - a 99\u00a2 bagel with cream cheese or a 99\u00a2 sausage and biscuit! Bring
49
- a printed copy of this notification or show this screen on your smart-phone
50
- to take advantage of this delicious offer!\n\n","public_delivery_description":"I
51
- just got breakfast for 99 cents by checking in","single_delivery":false,"type":"badge_reward","reward_file":"FreeBreakfastBarcode.png"},"trigger_schedule":{"rewarding":"once","winner_picked":"activity_interval","interval":1,"human_readable":"Rewarded
52
- once when a user reaches 1 relevant actions or points."}},"badge_reward":{"private_delivery_description":"Thanks
53
- for checking-in with You have earned your first discount
54
- - a 99\u00a2 bagel with cream cheese or a 99\u00a2 sausage and biscuit! Bring
55
- a printed copy of this notification or show this screen on your smart-phone
56
- to take advantage of this delicious offer!\n\nDon''t forget to Like us on Facebook
57
- to earn another great reward from !","public_delivery_description":"I
58
- just got breakfast for 99 cents by checking in at","single_delivery":false,"type":"badge_reward","reward_file":"FreeBreakfastBarcode.png"}}}]}}]}}'
59
- 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/votes?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.2
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/1.0.11
21
- date:
22
- - Tue, 17 Apr 2012 15:57: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
- - "\"e5be3080253b60063d29411e65400701\""
37
- cache-control:
38
- - must-revalidate, private, max-age=0
39
- x-runtime:
40
- - "0.101455"
41
- x-rack-cache:
42
- - miss
43
- body: "{\"total_pages\":1,\"votes\":[{\"vote\":{\"created_at\":\"2012-04-09T05:42:37-05:00\",\"user\":{\"id\":36,\"href\":\"https://staging.checkd.in/api/v1/users/36.json\"},\"activity\":{\"id\":18881,\"href\":\"https://staging.checkd.in/api/v1/activities/18881.json\"}}},{\"vote\":{\"created_at\":\"2012-04-08T06:52:18-05:00\",\"user\":{\"id\":36,\"href\":\"https://staging.checkd.in/api/v1/users/36.json\"},\"activity\":{\"id\":18881,\"href\":\"https://staging.checkd.in/api/v1/activities/18881.json\"}}},{\"vote\":{\"created_at\":\"2012-04-08T06:52:12-05:00\",\"user\":{\"id\":36,\"href\":\"https://staging.checkd.in/api/v1/users/36.json\"},\"activity\":{\"id\":18881,\"href\":\"https://staging.checkd.in/api/v1/activities/18881.json\"}}}]}"
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/votes?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.2
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/1.0.11
21
- date:
22
- - Tue, 17 Apr 2012 15:57:36 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
- - "\"0b1ec43ded6cc7875c4c284e7e112874\""
37
- cache-control:
38
- - must-revalidate, private, max-age=0
39
- x-runtime:
40
- - "0.047213"
41
- x-rack-cache:
42
- - miss
43
- body: "{\"total_pages\":1,\"votes\":[{\"vote\":{\"created_at\":\"2012-04-09T05:42:37-05:00\",\"user\":{\"id\":36,\"href\":\"https://staging.checkd.in/api/v1/users/36.json\"},\"activity\":{\"id\":18881,\"href\":\"https://staging.checkd.in/api/v1/activities/18881.json\"}}},{\"vote\":{\"created_at\":\"2012-04-09T05:38:50-05:00\",\"user\":null,\"activity\":{\"id\":18881,\"href\":\"https://staging.checkd.in/api/v1/activities/18881.json\"}}},{\"vote\":{\"created_at\":\"2012-04-08T06:52:18-05:00\",\"user\":{\"id\":36,\"href\":\"https://staging.checkd.in/api/v1/users/36.json\"},\"activity\":{\"id\":18881,\"href\":\"https://staging.checkd.in/api/v1/activities/18881.json\"}}},{\"vote\":{\"created_at\":\"2012-04-08T06:52:12-05:00\",\"user\":{\"id\":36,\"href\":\"https://staging.checkd.in/api/v1/users/36.json\"},\"activity\":{\"id\":18881,\"href\":\"https://staging.checkd.in/api/v1/activities/18881.json\"}}},{\"vote\":{\"created_at\":\"2012-04-08T06:51:53-05:00\",\"user\":null,\"activity\":{\"id\":18881,\"href\":\"https://staging.checkd.in/api/v1/activities/18881.json\"}}},{\"vote\":{\"created_at\":\"2012-04-08T06:30:05-05:00\",\"user\":null,\"activity\":{\"id\":18881,\"href\":\"https://staging.checkd.in/api/v1/activities/18881.json\"}}},{\"vote\":{\"created_at\":\"2012-04-08T06:26:47-05:00\",\"user\":null,\"activity\":{\"id\":18881,\"href\":\"https://staging.checkd.in/api/v1/activities/18881.json\"}}}]}"
44
- http_version: "1.1"
@@ -1,53 +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/won_rewards?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 17:36:24 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
- - ! '"b76dad81b38fe344ec8830b8f2162988"'
35
- cache-control:
36
- - max-age=0, private, must-revalidate
37
- x-runtime:
38
- - '0.211191'
39
- x-rack-cache:
40
- - miss
41
- body: ! '{"total_pages":56,"won_rewards":[{"won_reward":{"points_when_rewarded":null,"points_needed":null,"public_delivery_description":"","private_delivery_description":"Thank
42
- you","created_at":"2012-02-08T09:00:34-06:00","href":"https://app.checkd.in/api/v1/won_rewards/142.json","campaign":{"name":"Check
43
- In","description":"Check in
44
- more!","start_date":"2011-10-17","end_date":"2012-10-17","href":"https://app.checkd.in/api/v1/campaigns/2.json"},"promotion":{"type":"PromotionLbsCheckin","title":"Get
45
- a FREE coffee for every 5 check ins!","description":"Every 5 times you check
46
- in you will be rewarded with a free
47
- coffee! Enjoy!","href":"https://app.checkd.in/api/v1/promotions/8.json"},"user":{"id":64,"username":"bdoyk","created_at":"2011-10-19T08:32:38-05:00","first_name":null,"last_name":null,"birth_date":"1982-07-22","gender":null,"avatar_url":"https://prod-checkdin-user.s3.amazonaws.com/uploads/64/FYWYJX0YHPSVHPKP.jpg","href":"https://app.checkd.in/api/v1/won_rewards.json?user_id=64","postal_code":{"postal_code":"37206","locality":"NASHVILLE","state":"Tennessee","state_abbr":"TN","county":"DAVIDSON","lat":36.180806,"lon":-86.741761}}}},{"won_reward":{"points_when_rewarded":null,"points_needed":null,"public_delivery_description":"I
48
- just got breakfast for 99 cents","private_delivery_description":"Thank you","created_at":"2012-01-27T09:03:21-06:00","href":"https://app.checkd.in/api/v1/won_rewards/141.json","campaign":{"name":"Check
49
- In ","description":"Check in to win free coffee and
50
- more!","start_date":"2011-10-17","end_date":"2012-10-17","href":"https://app.checkd.in/api/v1/campaigns/2.json"},"promotion":{"type":"PromotionLbsCheckin","title":"Check
51
- in and get breakfast for 99 cents!","description":"Check in at our new location
52
- ","href":"https://app.checkd.in/api/v1/promotions/7.json"},"user":{"id":187,"username":"krhoch","created_at":"2012-01-26T08:16:48-06:00","first_name":null,"last_name":null,"birth_date":"1986-05-29","gender":"male","avatar_url":"https://prod-checkdin-user.s3.amazonaws.com/uploads/187/ROPQUJ0DZBN00OQB.jpg","href":"https://app.checkd.in/api/v1/won_rewards.json?user_id=187","postal_code":{"postal_code":"37212","locality":"NASHVILLE","state":"Tennessee","state_abbr":"TN","county":"DAVIDSON","lat":36.133251,"lon":-86.800573}}}}]}'
53
- http_version: '1.1'
@@ -1,49 +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/won_rewards/142?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 17:36:23 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
- - ! '"81e9f265a7e790c8b4233f7040a62545"'
35
- cache-control:
36
- - max-age=0, private, must-revalidate
37
- x-runtime:
38
- - '0.280210'
39
- x-rack-cache:
40
- - miss
41
- body: ! '{"won_reward":{"points_when_rewarded":null,"points_needed":null,"created_at":"2012-02-08T09:00:34-06:00","updated_at":"2012-02-08T09:00:34-06:00","public_delivery_description":"Free
42
- coffee","private_delivery_description":"Thank
43
- you","campaign":{"name":"Check In","description":"Check
44
- in 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"},"promotion":{"title":"A great promotion","description":"Every 5 times you check
45
- in at our location you will be rewarded with a free
46
- coffee! Enjoy!","terms":"","above_21_only":false,"ends_at":"2012-10-16T07:51:32-05:00","href":"https://app.checkd.in/api/v1/promotions/8.json","type":"promotion_lbs_checkin","place_groups":[{"place_group":{"name":"Stores","href":"https://app.checkd.in/api/v1/place_groups/2.json"}}],"reward":{"private_delivery_description":"Thank
47
- you","public_delivery_description":"Free coffee","single_delivery":false,"type":"badge_reward","reward_file":"5thCheckinBarcode.png"},"trigger_schedule":{"rewarding":"once","winner_picked":"activity_interval","interval":5,"human_readable":"Rewarded
48
- once when a user reaches 5 relevant actions or points."}},"reward":{"single_delivery":false,"type":"badge_reward","reward_file":"5thCheckinBarcode.png"},"user":{"id":64,"username":"bdoyk","created_at":"2011-10-19T08:32:38-05:00","first_name":null,"last_name":null,"birth_date":"1982-07-22","gender":null,"avatar_url":"https://prod-checkdin-user.s3.amazonaws.com/uploads/64/FYWYJX0YHPSVHPKP.jpg","href":"https://app.checkd.in/api/v1/won_rewards.json?user_id=64","postal_code":{"postal_code":"37206","locality":"NASHVILLE","state":"Tennessee","state_abbr":"TN","county":"DAVIDSON","lat":36.180806,"lon":-86.741761}}}}'
49
- http_version: '1.1'
data/spec/spec_helper.rb DELETED
@@ -1,49 +0,0 @@
1
- require 'rubygems'
2
- require 'simplecov'
3
- SimpleCov.start do
4
- add_filter "/spec"
5
- end
6
- require 'checkdin'
7
- require 'rspec'
8
-
9
- require 'webmock/rspec'
10
- require 'vcr'
11
-
12
- Dir["./spec/support/**/*.rb"].each {|f| require f}
13
-
14
- # Disallow all HTTP connections
15
- WebMock.disable_net_connect!
16
-
17
- # VCR is used for recording and replaying known API HTTP interactions
18
- VCR.config do |config|
19
- config.cassette_library_dir = File.join('spec', 'fixtures', 'vcr_cassettes')
20
-
21
- config.stub_with :webmock
22
-
23
- config.filter_sensitive_data('{client_id}') { TestCredentials.client_id }
24
- config.filter_sensitive_data('{client_secret}') { TestCredentials.client_secret }
25
- config.filter_sensitive_data('{api_url}') { TestCredentials.api_url }
26
-
27
- config.default_cassette_options = {
28
- :match_requests_on => [ :path ] # ignore hostname when finding a matching request in the VCR recording
29
- }
30
- end
31
-
32
- RSpec.configure do |config|
33
- config.extend VCR::RSpec::Macros
34
-
35
- # from https://github.com/myronmarston/vcr/issues/95
36
- config.around(:each, :vcr => proc { |vcr, metadata| !!vcr }) do |example|
37
- options = example.metadata[:vcr]
38
- case options
39
- when String
40
- options = { :cassette => options }
41
- when TrueClass
42
- options = {}
43
- end
44
- name = options.delete(:cassette) || example.metadata[:full_description].split(/\s+/, 2).join("/").underscore.gsub(/[^\w\/]+/, "_")
45
- VCR.use_cassette(name, options) { example.call }
46
- end
47
- end
48
-
49
- DEFAULT_HOST = 'http://www.example.com'