chute 2.1.2 → 2.1.3

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.
@@ -1,3 +1,9 @@
1
+ ## 2.1.3 knight-kill (2013-09-19)
2
+
3
+ ### Features
4
+
5
+ - **campaigns**: add basic campaign support (list, find, create)
6
+
1
7
  ## 2.1.0 knight-kill (2013-08-11)
2
8
 
3
9
  ### Features
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Status](https://circleci.com/gh/chute/chute-sdk-2.png?circle-token=3bc9af73f06e885870e3cf16b85e727ca074e1b6)](https://circleci.com/gh/chute/chute-sdk-2)
2
+
1
3
  # Chute API V2 wrapper gem
2
4
 
3
5
  > Access [Chute API V2](https://api.getchute.com/v2) from Ruby.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "chute"
8
- s.version = "2.1.2"
8
+ s.version = "2.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Darko Grozdanovski", "Chris Burkhart", "Petr Bela"]
12
- s.date = "2013-08-14"
12
+ s.date = "2013-09-19"
13
13
  s.description = "wrapper for the API for getchute.com"
14
14
  s.email = "support@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "lib/chute/v2/accounts.rb",
33
33
  "lib/chute/v2/albums.rb",
34
34
  "lib/chute/v2/assets.rb",
35
+ "lib/chute/v2/campaigns.rb",
35
36
  "lib/chute/v2/comments.rb",
36
37
  "lib/chute/v2/flags.rb",
37
38
  "lib/chute/v2/hearts.rb",
@@ -48,6 +49,7 @@ Gem::Specification.new do |s|
48
49
  "spec/chute/v2/accounts_spec.rb",
49
50
  "spec/chute/v2/albums_spec.rb",
50
51
  "spec/chute/v2/assets_spec.rb",
52
+ "spec/chute/v2/campaigns_spec.rb",
51
53
  "spec/chute/v2/comments_spec.rb",
52
54
  "spec/chute/v2/flags_spec.rb",
53
55
  "spec/chute/v2/hearts_spec.rb",
@@ -76,6 +78,9 @@ Gem::Specification.new do |s|
76
78
  "spec/fixtures/chute_cassettes/assets/assets_list.yml",
77
79
  "spec/fixtures/chute_cassettes/assets/assets_update.yml",
78
80
  "spec/fixtures/chute_cassettes/assets/assets_upload.yml",
81
+ "spec/fixtures/chute_cassettes/campaigns/campaign_get.yml",
82
+ "spec/fixtures/chute_cassettes/campaigns/campaigns.yml",
83
+ "spec/fixtures/chute_cassettes/campaigns/campaigns_create.yml",
79
84
  "spec/fixtures/chute_cassettes/comments/comments_create.yml",
80
85
  "spec/fixtures/chute_cassettes/comments/comments_list.yml",
81
86
  "spec/fixtures/chute_cassettes/flags/flags_methods.yml",
@@ -0,0 +1,23 @@
1
+ module Chute
2
+ module V2
3
+ class Campaigns
4
+ class << self
5
+ # Campaign Listing
6
+ def all(page=nil, per_page=nil)
7
+ Chute::Client.get("/v2/campaigns", :page=> page, :per_page=> per_page)
8
+ end
9
+
10
+ # Campaign Details
11
+ def find(id)
12
+ Chute::Client.get("/v2/campaigns/#{id}")
13
+ end
14
+
15
+ # Campaign Create
16
+ def create(campaign)
17
+ Chute::Client.post("/v2/campaigns", :campaign => campaign)
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
@@ -2,7 +2,7 @@ module Chute
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 1
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chute::V2::Campaigns do
4
+ include_context "init credentials"
5
+
6
+
7
+ describe "methods" do
8
+
9
+ describe ".all" do
10
+ it { Chute::V2::Campaigns.should respond_to(:all).with(0).arguments }
11
+ it { Chute::V2::Campaigns.should respond_to(:all).with(1).arguments }
12
+ it { Chute::V2::Campaigns.should respond_to(:all).with(2).arguments }
13
+ end
14
+
15
+ describe ".find" do
16
+ it { Chute::V2::Campaigns.should respond_to(:find).with(1).arguments }
17
+ it { Chute::V2::Campaigns.should_not respond_to(:find).with(0).arguments }
18
+ end
19
+
20
+ describe ".create" do
21
+ it { Chute::V2::Campaigns.should respond_to(:create).with(1).arguments }
22
+ it { Chute::V2::Campaigns.should_not respond_to(:create).with(2).arguments }
23
+ end
24
+
25
+ end
26
+
27
+ describe "requests" do
28
+ describe "GET Campaign List" do
29
+ before do
30
+ VCR.insert_cassette 'campaigns/campaigns', :record => :new_episodes
31
+ end
32
+ after do
33
+ VCR.eject_cassette
34
+ end
35
+
36
+ it "should be able to list all campaigns" do
37
+ response = Chute::V2::Campaigns.all
38
+ response.data.should_not == nil
39
+ end
40
+ end
41
+
42
+ describe "POST Campaign Create" do
43
+ it "should be able to create a campaign" do
44
+ VCR.insert_cassette 'campaigns/campaigns_create', :record => :new_episodes
45
+ campaign = Hash.new
46
+ campaign[:name] = "some campaign #{Time.now.to_s}"
47
+ response = Chute::V2::Campaigns.create(campaign)
48
+ VCR.eject_cassette
49
+ end
50
+ end
51
+
52
+ describe "GET Campaign by ID" do
53
+ before do
54
+ VCR.insert_cassette 'campaigns/campaign_get', :record => :new_episodes
55
+ end
56
+ after do
57
+ VCR.eject_cassette
58
+ end
59
+
60
+ it "should retrieve campaign by its id" do
61
+ id = Chute::V2::Campaigns.create({:name => "Created Campaign"}).data.id
62
+ response = Chute::V2::Campaigns.find(id)
63
+ response.data.id.should == id
64
+ end
65
+ end
66
+
67
+ end
68
+
69
+ end
@@ -0,0 +1,115 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.getchute.com/v2/campaigns
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"campaign":{"name":"Created Campaign"}}'
9
+ headers:
10
+ Authorization:
11
+ - Bearer API KEY
12
+ Content-Type:
13
+ - application/json
14
+ Accepts:
15
+ - application/json
16
+ X-Client-Id:
17
+ - 508fc620018d162a070000d6
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: Created
22
+ headers:
23
+ Cache-Control:
24
+ - max-age=0, private, must-revalidate
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Date:
28
+ - Thu, 19 Sep 2013 22:37:50 GMT
29
+ Etag:
30
+ - ! '"838d1771d4ea6f5460229aeb5224b265"'
31
+ Last-Modified:
32
+ - Thu, 19 Sep 2013 22:37:50 GMT
33
+ Server:
34
+ - nginx/1.2.7 + Phusion Passenger 3.0.18 (mod_rails/mod_rack)
35
+ Status:
36
+ - '201'
37
+ X-Powered-By:
38
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.18
39
+ X-Rack-Cache:
40
+ - invalidate, pass
41
+ X-Request-Id:
42
+ - 695a1309a6cc48304f180ca453d9b13d
43
+ X-Runtime:
44
+ - '0.031003'
45
+ X-Ua-Compatible:
46
+ - IE=Edge,chrome=1
47
+ Transfer-Encoding:
48
+ - chunked
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: US-ASCII
53
+ string: ! '{"response":{"title":"Campaign Details","version":2,"code":201,"href":"https://api.getchute.com/v2/campaigns"},"data":{"id":135,"links":{"self":{"href":"http://api.getchute.com/v2/campaigns/135","title":"Campaign
54
+ Details"}},"created_at":"2013-09-19T22:37:50Z","updated_at":"2013-09-19T22:37:50Z","name":"Created
55
+ Campaign","start_date":null,"end_date":null,"s3_access_key":null,"s3_bucket":null,"s3_secret":null,"ftp_hostname":null,"ftp_username":null,"ftp_password":null,"app_id_facebook":null,"app_secret_facebook":null,"app_id_flickr":null,"app_secret_flickr":null,"app_id_instagram":null,"app_secret_instagram":null,"app_id_google":null,"app_secret_google":null,"users":[{"id":545,"links":{"self":{"href":"http://api.getchute.com/v2/users/545","title":"User
56
+ Details"}},"created_at":"2012-01-17T19:53:39Z","updated_at":"2012-09-15T10:55:51Z","name":"darko1002001","username":"darko1002001","avatar":"http://static.getchute.com/v1/images/avatar-100x100.png","profile":null,"email":"darko@getchute.com","status":"verified"}]}}'
57
+ http_version:
58
+ recorded_at: Thu, 19 Sep 2013 22:37:50 GMT
59
+ - request:
60
+ method: get
61
+ uri: https://api.getchute.com/v2/campaigns/135
62
+ body:
63
+ encoding: UTF-8
64
+ string: ! '{}'
65
+ headers:
66
+ Authorization:
67
+ - Bearer API KEY
68
+ Content-Type:
69
+ - application/json
70
+ Accepts:
71
+ - application/json
72
+ X-Client-Id:
73
+ - 508fc620018d162a070000d6
74
+ response:
75
+ status:
76
+ code: 200
77
+ message: OK
78
+ headers:
79
+ Cache-Control:
80
+ - must-revalidate, private, max-age=0
81
+ Content-Type:
82
+ - application/json; charset=utf-8
83
+ Date:
84
+ - Thu, 19 Sep 2013 22:37:51 GMT
85
+ Etag:
86
+ - ! '"838d1771d4ea6f5460229aeb5224b265"'
87
+ Last-Modified:
88
+ - Thu, 19 Sep 2013 22:37:50 GMT
89
+ Server:
90
+ - nginx/1.2.7 + Phusion Passenger 3.0.18 (mod_rails/mod_rack)
91
+ Status:
92
+ - '200'
93
+ X-Powered-By:
94
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.18
95
+ X-Rack-Cache:
96
+ - miss
97
+ X-Request-Id:
98
+ - e30dbb091dec7b5e33d267f7dee6b8f6
99
+ X-Runtime:
100
+ - '0.165999'
101
+ X-Ua-Compatible:
102
+ - IE=Edge,chrome=1
103
+ Transfer-Encoding:
104
+ - chunked
105
+ Connection:
106
+ - keep-alive
107
+ body:
108
+ encoding: US-ASCII
109
+ string: ! '{"response":{"title":"Campaign Details","version":2,"code":200,"href":"https://api.getchute.com/v2/campaigns/135"},"data":{"id":135,"links":{"self":{"href":"http://api.getchute.com/v2/campaigns/135","title":"Campaign
110
+ Details"}},"created_at":"2013-09-19T22:37:50Z","updated_at":"2013-09-19T22:37:50Z","name":"Created
111
+ Campaign","start_date":null,"end_date":null,"s3_access_key":null,"s3_bucket":null,"s3_secret":null,"ftp_hostname":null,"ftp_username":null,"ftp_password":null,"app_id_facebook":null,"app_secret_facebook":null,"app_id_flickr":null,"app_secret_flickr":null,"app_id_instagram":null,"app_secret_instagram":null,"app_id_google":null,"app_secret_google":null,"users":[{"id":545,"links":{"self":{"href":"http://api.getchute.com/v2/users/545","title":"User
112
+ Details"}},"created_at":"2012-01-17T19:53:39Z","updated_at":"2012-09-15T10:55:51Z","name":"darko1002001","username":"darko1002001","avatar":"http://static.getchute.com/v1/images/avatar-100x100.png","profile":null,"email":"darko@getchute.com","status":"verified"}]}}'
113
+ http_version:
114
+ recorded_at: Thu, 19 Sep 2013 22:37:51 GMT
115
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.getchute.com/v2/campaigns
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"page":null,"per_page":null}'
9
+ headers:
10
+ Authorization:
11
+ - Bearer API KEY
12
+ Content-Type:
13
+ - application/json
14
+ Accepts:
15
+ - application/json
16
+ X-Client-Id:
17
+ - 508fc620018d162a070000d6
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Cache-Control:
24
+ - must-revalidate, private, max-age=0
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Date:
28
+ - Thu, 19 Sep 2013 22:37:29 GMT
29
+ Etag:
30
+ - ! '"a39e8075a654f52053a4b6ac574926c5"'
31
+ Last-Modified:
32
+ - Thu, 29 Aug 2013 00:31:14 GMT
33
+ Server:
34
+ - nginx/1.2.7 + Phusion Passenger 3.0.18 (mod_rails/mod_rack)
35
+ Status:
36
+ - '200'
37
+ X-Powered-By:
38
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.18
39
+ X-Rack-Cache:
40
+ - miss
41
+ X-Request-Id:
42
+ - f76b5e3e49ce3cceb2148332b663f0d0
43
+ X-Runtime:
44
+ - '0.112839'
45
+ X-Ua-Compatible:
46
+ - IE=Edge,chrome=1
47
+ Transfer-Encoding:
48
+ - chunked
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: US-ASCII
53
+ string: ! '{"response":{"title":"Campaign Listing","version":2,"code":200,"href":"https://api.getchute.com/v2/campaigns"},"data":[{"id":77,"links":{"self":{"href":"http://api.getchute.com/v2/campaigns/77","title":"Campaign
54
+ Details"}},"created_at":"2013-08-29T00:31:14Z","updated_at":"2013-08-29T00:31:14Z","name":"Test","start_date":null,"end_date":null,"s3_access_key":null,"s3_bucket":null,"s3_secret":null,"ftp_hostname":null,"ftp_username":null,"ftp_password":null,"app_id_facebook":null,"app_secret_facebook":null,"app_id_flickr":null,"app_secret_flickr":null,"app_id_instagram":null,"app_secret_instagram":null,"app_id_google":null,"app_secret_google":null,"users":[{"id":545,"links":{"self":{"href":"http://api.getchute.com/v2/users/545","title":"User
55
+ Details"}},"created_at":"2012-01-17T19:53:39Z","updated_at":"2012-09-15T10:55:51Z","name":"darko1002001","username":"darko1002001","avatar":"http://static.getchute.com/v1/images/avatar-100x100.png","profile":null,"email":"darko@getchute.com","status":"verified"}]}]}'
56
+ http_version:
57
+ recorded_at: Thu, 19 Sep 2013 22:37:29 GMT
58
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.getchute.com/v2/campaigns
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"campaign":{"name":"some campaign 2013-09-19 15:37:49 -0700"}}'
9
+ headers:
10
+ Authorization:
11
+ - Bearer API KEY
12
+ Content-Type:
13
+ - application/json
14
+ Accepts:
15
+ - application/json
16
+ X-Client-Id:
17
+ - 508fc620018d162a070000d6
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: Created
22
+ headers:
23
+ Cache-Control:
24
+ - max-age=0, private, must-revalidate
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Date:
28
+ - Thu, 19 Sep 2013 22:37:50 GMT
29
+ Etag:
30
+ - ! '"6a5e0cd7c9fe59e5c102d189d9e32832"'
31
+ Last-Modified:
32
+ - Thu, 19 Sep 2013 22:37:50 GMT
33
+ Server:
34
+ - nginx/1.2.7 + Phusion Passenger 3.0.18 (mod_rails/mod_rack)
35
+ Status:
36
+ - '201'
37
+ X-Powered-By:
38
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.18
39
+ X-Rack-Cache:
40
+ - invalidate, pass
41
+ X-Request-Id:
42
+ - 32b954803ff062ec4962cd1909b628bf
43
+ X-Runtime:
44
+ - '0.088345'
45
+ X-Ua-Compatible:
46
+ - IE=Edge,chrome=1
47
+ Transfer-Encoding:
48
+ - chunked
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: US-ASCII
53
+ string: ! '{"response":{"title":"Campaign Details","version":2,"code":201,"href":"https://api.getchute.com/v2/campaigns"},"data":{"id":134,"links":{"self":{"href":"http://api.getchute.com/v2/campaigns/134","title":"Campaign
54
+ Details"}},"created_at":"2013-09-19T22:37:50Z","updated_at":"2013-09-19T22:37:50Z","name":"some
55
+ campaign 2013-09-19 15:37:49 -0700","start_date":null,"end_date":null,"s3_access_key":null,"s3_bucket":null,"s3_secret":null,"ftp_hostname":null,"ftp_username":null,"ftp_password":null,"app_id_facebook":null,"app_secret_facebook":null,"app_id_flickr":null,"app_secret_flickr":null,"app_id_instagram":null,"app_secret_instagram":null,"app_id_google":null,"app_secret_google":null,"users":[{"id":545,"links":{"self":{"href":"http://api.getchute.com/v2/users/545","title":"User
56
+ Details"}},"created_at":"2012-01-17T19:53:39Z","updated_at":"2012-09-15T10:55:51Z","name":"darko1002001","username":"darko1002001","avatar":"http://static.getchute.com/v1/images/avatar-100x100.png","profile":null,"email":"darko@getchute.com","status":"verified"}]}}'
57
+ http_version:
58
+ recorded_at: Thu, 19 Sep 2013 22:37:50 GMT
59
+ recorded_with: VCR 2.5.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chute
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-08-14 00:00:00.000000000 Z
14
+ date: 2013-09-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: httparty
@@ -164,6 +164,7 @@ files:
164
164
  - lib/chute/v2/accounts.rb
165
165
  - lib/chute/v2/albums.rb
166
166
  - lib/chute/v2/assets.rb
167
+ - lib/chute/v2/campaigns.rb
167
168
  - lib/chute/v2/comments.rb
168
169
  - lib/chute/v2/flags.rb
169
170
  - lib/chute/v2/hearts.rb
@@ -180,6 +181,7 @@ files:
180
181
  - spec/chute/v2/accounts_spec.rb
181
182
  - spec/chute/v2/albums_spec.rb
182
183
  - spec/chute/v2/assets_spec.rb
184
+ - spec/chute/v2/campaigns_spec.rb
183
185
  - spec/chute/v2/comments_spec.rb
184
186
  - spec/chute/v2/flags_spec.rb
185
187
  - spec/chute/v2/hearts_spec.rb
@@ -208,6 +210,9 @@ files:
208
210
  - spec/fixtures/chute_cassettes/assets/assets_list.yml
209
211
  - spec/fixtures/chute_cassettes/assets/assets_update.yml
210
212
  - spec/fixtures/chute_cassettes/assets/assets_upload.yml
213
+ - spec/fixtures/chute_cassettes/campaigns/campaign_get.yml
214
+ - spec/fixtures/chute_cassettes/campaigns/campaigns.yml
215
+ - spec/fixtures/chute_cassettes/campaigns/campaigns_create.yml
211
216
  - spec/fixtures/chute_cassettes/comments/comments_create.yml
212
217
  - spec/fixtures/chute_cassettes/comments/comments_list.yml
213
218
  - spec/fixtures/chute_cassettes/flags/flags_methods.yml
@@ -240,7 +245,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
240
245
  version: '0'
241
246
  segments:
242
247
  - 0
243
- hash: -4345887724898428816
248
+ hash: 3521415362243172776
244
249
  required_rubygems_version: !ruby/object:Gem::Requirement
245
250
  none: false
246
251
  requirements: