chute 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/chute.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "chute"
8
- s.version = "2.0.1"
8
+ s.version = "2.0.2"
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-04-22"
12
+ s.date = "2013-06-18"
13
13
  s.description = "wrapper for the API for getchute.com"
14
14
  s.email = "support@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -60,6 +60,8 @@ Gem::Specification.new do |s|
60
60
  "spec/fixtures/chute_cassettes/albums/albums_create.yml",
61
61
  "spec/fixtures/chute_cassettes/albums/albums_delete.yml",
62
62
  "spec/fixtures/chute_cassettes/albums/albums_get.yml",
63
+ "spec/fixtures/chute_cassettes/albums/albums_import_assets.yml",
64
+ "spec/fixtures/chute_cassettes/albums/albums_import_assets_from_instagram_id.yml",
63
65
  "spec/fixtures/chute_cassettes/albums/albums_list.yml",
64
66
  "spec/fixtures/chute_cassettes/albums/albums_stats.yml",
65
67
  "spec/fixtures/chute_cassettes/albums/albums_update.yml",
@@ -27,6 +27,11 @@ module Chute
27
27
  Chute::Client.post("/v2/albums/#{album_id}/assets/import", :urls=> urls)
28
28
  end
29
29
 
30
+ # Import from Instagram Ids
31
+ def import_from_instagram(album_id, *ids)
32
+ Chute::Client.post("/v2/albums/#{album_id}/assets/import", :instagram_ids => ids)
33
+ end
34
+
30
35
  # Album Create
31
36
  def create(album)
32
37
  Chute::Client.post("/v2/albums", :album => album)
data/lib/chute/version.rb CHANGED
@@ -2,7 +2,7 @@ module Chute
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 0
5
- PATCH = 1
5
+ PATCH = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -192,6 +192,26 @@ describe Chute::V2::Albums do
192
192
 
193
193
  end
194
194
 
195
+ describe "POST to import Assets" do
196
+
197
+ let(:id) { Chute::V2::Albums.create({:name => "Created Album"}).data.id }
198
+
199
+ it "should be able to import assets from instagram_id" do
200
+ VCR.insert_cassette 'albums/albums_import_assets_from_instagram_id', :record => :new_episodes
201
+ response = Chute::V2::Albums.import_from_instagram(id, '428193445044210234_1895177')
202
+ response.should be_true
203
+ VCR.eject_cassette
204
+ end
205
+
206
+ it "should be able to import assets from urls" do
207
+ VCR.insert_cassette 'albums/albums_import_assets', :record => :new_episodes
208
+ response = Chute::V2::Albums.import(id, "http://instagram.com/p/aUxwpugsqp/")
209
+ response.should be_true
210
+ VCR.eject_cassette
211
+ end
212
+
213
+ end
214
+
195
215
  end
196
216
 
197
217
  end
@@ -0,0 +1,118 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.getchute.com/v2/albums
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"album":{"name":"Created Album"}}'
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
+ - Mon, 17 Jun 2013 23:58:02 GMT
29
+ Etag:
30
+ - ! '"ae4c1eea2ccb2e6ff2915736e082c6f7"'
31
+ Last-Modified:
32
+ - Mon, 17 Jun 2013 23:58:02 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
+ - f7c2db6da4330cebf6837528b8f963df
43
+ X-Runtime:
44
+ - '0.068095'
45
+ X-Ua-Compatible:
46
+ - IE=Edge,chrome=1
47
+ Content-Length:
48
+ - '920'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: US-ASCII
53
+ string: ! '{"response":{"title":"Album Details","version":2,"code":201,"href":"https://api.getchute.com/v2/albums"},"data":{"id":2439245,"links":{"self":{"href":"http://api.getchute.com/v2/albums/2439245","title":"Album
54
+ Details"},"assets":{"href":"http://api.getchute.com/v2/albums/2439245/assets","title":"Asset
55
+ Listing"},"parcels":{"href":"http://api.getchute.com/v2/albums/2439245/parcels","title":"Parcel
56
+ Listing"}},"created_at":"2013-06-17T23:58:02Z","updated_at":"2013-06-17T23:58:02Z","shortcut":"aeyFmcbt","name":"Created
57
+ Album","description":null,"user":{"id":545,"links":{"self":{"href":"http://api.getchute.com/v2/users/545","title":"User
58
+ 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},"moderate_media":false,"moderate_comments":false,"parent_id":null}}'
59
+ http_version:
60
+ recorded_at: Mon, 17 Jun 2013 23:58:03 GMT
61
+ - request:
62
+ method: post
63
+ uri: https://api.getchute.com/v2/albums/2439245/assets/import
64
+ body:
65
+ encoding: UTF-8
66
+ string: ! '{"instagram_ids":["428193445044210234_1895177"]}'
67
+ headers:
68
+ Authorization:
69
+ - Bearer API KEY
70
+ Content-Type:
71
+ - application/json
72
+ Accepts:
73
+ - application/json
74
+ X-Client-Id:
75
+ - 508fc620018d162a070000d6
76
+ response:
77
+ status:
78
+ code: 200
79
+ message: OK
80
+ headers:
81
+ Cache-Control:
82
+ - max-age=0, private, must-revalidate
83
+ Content-Type:
84
+ - application/json; charset=utf-8
85
+ Date:
86
+ - Mon, 17 Jun 2013 23:58:03 GMT
87
+ Etag:
88
+ - ! '"27e76886d3d127b588dcea4d6caa273c"'
89
+ Last-Modified:
90
+ - Mon, 17 Jun 2013 23:58:03 GMT
91
+ Server:
92
+ - nginx/1.2.7 + Phusion Passenger 3.0.18 (mod_rails/mod_rack)
93
+ Status:
94
+ - '200'
95
+ X-Powered-By:
96
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.18
97
+ X-Rack-Cache:
98
+ - invalidate, pass
99
+ X-Request-Id:
100
+ - e07bd59e43ea8f5879bdd5e328dfaad1
101
+ X-Runtime:
102
+ - '1.139838'
103
+ X-Ua-Compatible:
104
+ - IE=Edge,chrome=1
105
+ Content-Length:
106
+ - '1704'
107
+ Connection:
108
+ - keep-alive
109
+ body:
110
+ encoding: US-ASCII
111
+ string: ! '{"response":{"title":"Imported Assets","version":2,"code":200,"href":"https://api.getchute.com/v2/albums/2439245/assets/import"},"data":[{"id":540716246,"links":{"self":{"href":"http://api.getchute.com/v2/albums/2439245/assets/540716246","title":"Asset
112
+ Details"},"exif":{"href":"http://api.getchute.com/v2/albums/2439245/assets/540716246/exif","title":"Exif
113
+ Details"},"geo":{"href":"http://api.getchute.com/v2/albums/2439245/assets/540716246/geo","title":"Geo
114
+ Details"},"heart":{"href":"http://api.getchute.com/v2/albums/2439245/assets/540716246/hearts","title":"Heart"},"vote":{"href":"http://api.getchute.com/v2/albums/2439245/assets/540716246/votes","title":"Vote"}},"created_at":"2013-06-17T23:58:03Z","updated_at":"2013-06-17T23:58:03Z","thumbnail":"http://distilleryimage6.s3.amazonaws.com/913457e09ed411e284b222000a1fbcf6_5.jpg","url":"http://media.getchute.com/media/AAMZMbrws","shortcut":"AAMZMbrws","type":"image","caption":"#PHD4","dimensions":{"width":612,"height":612},"location":{"latitude":"37.483270059","longitude":"-122.14953661"},"source":{"source":"import","source_id":"428193445044210234_1895177","source_url":"http://distilleryimage6.s3.amazonaws.com/913457e09ed411e284b222000a1fbcf6_7.jpg","service":"instagram","import_id":"428193445044210234_1895177","import_url":"http://distilleryimage6.s3.amazonaws.com/913457e09ed411e284b222000a1fbcf6_7.jpg"},"service":"instagram","user":{"id":545,"links":{"self":{"href":"http://api.getchute.com/v2/users/545","title":"User
115
+ 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}}]}'
116
+ http_version:
117
+ recorded_at: Mon, 17 Jun 2013 23:58:04 GMT
118
+ recorded_with: VCR 2.2.5
@@ -0,0 +1,117 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.getchute.com/v2/albums
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"album":{"name":"Created Album"}}'
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
+ - Mon, 17 Jun 2013 23:59:50 GMT
29
+ Etag:
30
+ - ! '"cb60f9949ad98e0c4fb5bdc74ae0df86"'
31
+ Last-Modified:
32
+ - Mon, 17 Jun 2013 23:59: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
+ - 54d656ae2b4c29b27f2d04d70f958b18
43
+ X-Runtime:
44
+ - '0.195204'
45
+ X-Ua-Compatible:
46
+ - IE=Edge,chrome=1
47
+ Content-Length:
48
+ - '920'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: US-ASCII
53
+ string: ! '{"response":{"title":"Album Details","version":2,"code":201,"href":"https://api.getchute.com/v2/albums"},"data":{"id":2439247,"links":{"self":{"href":"http://api.getchute.com/v2/albums/2439247","title":"Album
54
+ Details"},"assets":{"href":"http://api.getchute.com/v2/albums/2439247/assets","title":"Asset
55
+ Listing"},"parcels":{"href":"http://api.getchute.com/v2/albums/2439247/parcels","title":"Parcel
56
+ Listing"}},"created_at":"2013-06-17T23:59:50Z","updated_at":"2013-06-17T23:59:50Z","shortcut":"aeyHofbg","name":"Created
57
+ Album","description":null,"user":{"id":545,"links":{"self":{"href":"http://api.getchute.com/v2/users/545","title":"User
58
+ 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},"moderate_media":false,"moderate_comments":false,"parent_id":null}}'
59
+ http_version:
60
+ recorded_at: Mon, 17 Jun 2013 23:59:51 GMT
61
+ - request:
62
+ method: post
63
+ uri: https://api.getchute.com/v2/albums/2439247/assets/import
64
+ body:
65
+ encoding: UTF-8
66
+ string: ! '{"instagram_ids":["428193445044210234_1895177"]}'
67
+ headers:
68
+ Authorization:
69
+ - Bearer API KEY
70
+ Content-Type:
71
+ - application/json
72
+ Accepts:
73
+ - application/json
74
+ X-Client-Id:
75
+ - 508fc620018d162a070000d6
76
+ response:
77
+ status:
78
+ code: 200
79
+ message: OK
80
+ headers:
81
+ Cache-Control:
82
+ - max-age=0, private, must-revalidate
83
+ Content-Type:
84
+ - application/json; charset=utf-8
85
+ Date:
86
+ - Mon, 17 Jun 2013 23:59:52 GMT
87
+ Etag:
88
+ - ! '"27e76886d3d127b588dcea4d6caa273c"'
89
+ Last-Modified:
90
+ - Mon, 17 Jun 2013 23:58:03 GMT
91
+ Server:
92
+ - nginx/1.2.7 + Phusion Passenger 3.0.18 (mod_rails/mod_rack)
93
+ Status:
94
+ - '200'
95
+ X-Powered-By:
96
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.18
97
+ X-Rack-Cache:
98
+ - invalidate, pass
99
+ X-Request-Id:
100
+ - 98e49505401f8167aa6c5d85df98b56a
101
+ X-Runtime:
102
+ - '1.656449'
103
+ X-Ua-Compatible:
104
+ - IE=Edge,chrome=1
105
+ Content-Length:
106
+ - '1395'
107
+ Connection:
108
+ - keep-alive
109
+ body:
110
+ encoding: US-ASCII
111
+ string: ! '{"response":{"title":"Imported Assets","version":2,"code":200,"href":"https://api.getchute.com/v2/albums/2439247/assets/import"},"data":[{"id":540716246,"links":{"self":{"href":"http://api.getchute.com/v2/albums/2439247/assets/540716246","title":"Asset
112
+ Details"},"exif":{"href":"http://api.getchute.com/v2/albums/2439247/assets/540716246/exif","title":"Exif
113
+ Details"},"geo":{"href":"http://api.getchute.com/v2/albums/2439247/assets/540716246/geo","title":"Geo
114
+ Details"},"heart":{"href":"http://api.getchute.com/v2/albums/2439247/assets/540716246/hearts","title":"Heart"},"vote":{"href":"http://api.getchute.com/v2/albums/2439247/assets/540716246/votes","title":"Vote"}},"created_at":"2013-06-17T23:58:03Z","updated_at":"2013-06-17T23:58:03Z","thumbnail":"http://distilleryimage6.s3.amazonaws.com/913457e09ed411e284b222000a1fbcf6_5.jpg","url":"http://media.getchute.com/media/AAMZMbrws","shortcut":"AAMZMbrws","type":"image","caption":"#PHD4","dimensions":{"width":612,"height":612},"location":{"latitude":"37.48327006","longitude":"-122.14953661"},"source":{"source":"import","source_id":"428193445044210234_1895177","source_url":"http://distilleryimage6.s3.amazonaws.com/913457e09ed411e284b222000a1fbcf6_7.jpg","service":"instagram","import_id":"428193445044210234_1895177","import_url":"http://distilleryimage6.s3.amazonaws.com/913457e09ed411e284b222000a1fbcf6_7.jpg"},"service":"instagram"}]}'
115
+ http_version:
116
+ recorded_at: Mon, 17 Jun 2013 23:59:53 GMT
117
+ recorded_with: VCR 2.2.5
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.0.1
4
+ version: 2.0.2
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-04-22 00:00:00.000000000 Z
14
+ date: 2013-06-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: httparty
@@ -176,6 +176,8 @@ files:
176
176
  - spec/fixtures/chute_cassettes/albums/albums_create.yml
177
177
  - spec/fixtures/chute_cassettes/albums/albums_delete.yml
178
178
  - spec/fixtures/chute_cassettes/albums/albums_get.yml
179
+ - spec/fixtures/chute_cassettes/albums/albums_import_assets.yml
180
+ - spec/fixtures/chute_cassettes/albums/albums_import_assets_from_instagram_id.yml
179
181
  - spec/fixtures/chute_cassettes/albums/albums_list.yml
180
182
  - spec/fixtures/chute_cassettes/albums/albums_stats.yml
181
183
  - spec/fixtures/chute_cassettes/albums/albums_update.yml
@@ -215,7 +217,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
217
  version: '0'
216
218
  segments:
217
219
  - 0
218
- hash: 2650277714762767781
220
+ hash: -3155197755455506569
219
221
  required_rubygems_version: !ruby/object:Gem::Requirement
220
222
  none: false
221
223
  requirements: