chute 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/chute.gemspec +1 -1
- data/lib/chute/configuration.rb +2 -2
- data/lib/chute/connection.rb +4 -11
- data/lib/chute/version.rb +1 -1
- data/spec/chute/connection_spec.rb +10 -0
- data/spec/fixtures/chute_cassettes/assets/assets_upload.yml +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b91ab61d2e4c1c36936d64eb195e86837551c15
|
4
|
+
data.tar.gz: 0a39778b784e9cab3957ba85b026e55662660c4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aec1ef988c041dc23a10b9934221081a59999b0f260d83aa1d517bb8ebd24a0e158d6d07f7a5d2f5bf02551304a746b86c147642a83f4f07b6824bfa1462f373
|
7
|
+
data.tar.gz: b000178c7b6158242a40b62defbb6050178051311a560dbd6fd8e8fe07032bb60db136b8576ea75287278cac44f62e92ff168389ca68107fe2bebb3d9088ae8f
|
data/chute.gemspec
CHANGED
data/lib/chute/configuration.rb
CHANGED
@@ -8,7 +8,7 @@ module Chute
|
|
8
8
|
|
9
9
|
DEFAULT_API_ENDPOINT = 'https://api.getchute.com'
|
10
10
|
DEFAULT_AUTH_ENDPOINT = 'https://getchute.com/auth'
|
11
|
-
DEFAULT_UPLOAD_ENDPOINT = '
|
11
|
+
DEFAULT_UPLOAD_ENDPOINT = 'https://upload.getchute.com'
|
12
12
|
|
13
13
|
DEFAULT_APP_ID = 'app_id'
|
14
14
|
DEFAULT_APP_SECRET = 'app_secret'
|
@@ -39,4 +39,4 @@ module Chute
|
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
42
|
-
end
|
42
|
+
end
|
data/lib/chute/connection.rb
CHANGED
@@ -23,25 +23,18 @@ module Chute
|
|
23
23
|
def self.request(request_type, url, body="")
|
24
24
|
body = body.to_json unless String === body
|
25
25
|
options = body.empty? ? {headers: headers} : {headers: headers, body: body}
|
26
|
-
begin
|
27
|
-
response = self.send(request_type, "#{base_uri}#{url}", options)
|
28
|
-
=begin
|
29
|
-
|
30
|
-
puts "----------------------------------------"
|
31
|
-
puts "Requesting url: #{base_uri}#{url}"
|
32
|
-
puts response.parsed_response
|
33
|
-
puts "----------------------------------------"
|
34
|
-
=end
|
35
26
|
|
27
|
+
begin
|
28
|
+
response = send(request_type, "#{base_uri}#{url}", options)
|
36
29
|
parse(response)
|
37
30
|
rescue Errno::ECONNREFUSED
|
38
31
|
p 'Service Unavailable'
|
39
32
|
Chute::Response.with_code_and_error(503, 'Service Unavailable')
|
40
33
|
raise ChuteApiUnavailableException.new('Could not connect to the Server')
|
41
|
-
rescue MultiJson::DecodeError
|
34
|
+
rescue MultiJson::DecodeError => ex
|
42
35
|
p 'Internal Server Error'
|
43
36
|
Chute::Response.with_code_and_error(500, 'Internal Server Error')
|
44
|
-
raise ChuteApiInternalException
|
37
|
+
raise ChuteApiInternalException, "Chute API Exception. #{ex.message}"
|
45
38
|
rescue Exception => ex
|
46
39
|
p 'Unknown Error'
|
47
40
|
raise
|
data/lib/chute/version.rb
CHANGED
@@ -13,6 +13,16 @@ describe Chute::Connection do
|
|
13
13
|
it { Chute::Connection.should respond_to(:request).with(2).arguments }
|
14
14
|
it { Chute::Connection.should respond_to(:request).with(3).arguments }
|
15
15
|
it { Chute::Connection.should_not respond_to(:request).with(0).arguments}
|
16
|
+
|
17
|
+
context 'on MultiJson error' do
|
18
|
+
it 'raises ChuteApiInternalException with the original exception message' do
|
19
|
+
message = 'MultiJson error'
|
20
|
+
allow(Chute::Connection).to receive(:get).and_raise(MultiJson::DecodeError, message)
|
21
|
+
|
22
|
+
expect { Chute::Connection.request(:get, '/profile') }.
|
23
|
+
to raise_error(Chute::ChuteApiInternalException, Regexp.new(message))
|
24
|
+
end
|
25
|
+
end
|
16
26
|
end
|
17
27
|
|
18
28
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: post
|
5
|
-
uri:
|
5
|
+
uri: https://upload.getchute.com/v2/albums/2443331/assets/upload
|
6
6
|
body:
|
7
7
|
encoding: ASCII-8BIT
|
8
8
|
string: !binary |-
|
@@ -3857,7 +3857,7 @@ http_interactions:
|
|
3857
3857
|
- keep-alive
|
3858
3858
|
body:
|
3859
3859
|
encoding: US-ASCII
|
3860
|
-
string: ! '{"response":{"title":"Uploaded Assets","version":2,"code":200,"href":"
|
3860
|
+
string: ! '{"response":{"title":"Uploaded Assets","version":2,"code":200,"href":"https://upload.getchute.com/v2/albums/2443331/assets/upload_complete"},"data":[{"id":579020570,"links":{"self":{"href":"http://api.getchute.com/v2/albums/2443331/assets/579020570","title":"Asset
|
3861
3861
|
Details"},"exif":{"href":"http://api.getchute.com/v2/albums/2443331/assets/579020570/exif","title":"Exif
|
3862
3862
|
Details"},"geo":{"href":"http://api.getchute.com/v2/albums/2443331/assets/579020570/geo","title":"Geo
|
3863
3863
|
Details"},"heart":{"href":"http://api.getchute.com/v2/albums/2443331/assets/579020570/hearts","title":"Heart"},"vote":{"href":"http://api.getchute.com/v2/albums/2443331/assets/579020570/votes","title":"Vote"}},"created_at":"2013-07-03T22:44:26Z","updated_at":"2013-07-03T22:44:26Z","thumbnail":"http://s3.amazonaws.com/uploader-media.getchute.com/uploads/RExUbEE2dHMdq2NzEiya2KlHzNIe0XnO/thumb_RExUbEE2dHMdq2NzEiya2KlHzNIe0XnOtest_image.jpg","url":"http://media.getchute.com/media/DbvHsmyjc","shortcut":"DbvHsmyjc","type":"image","caption":null,"dimensions":{"width":null,"height":null},"location":null,"source":{"source":"uploaded","source_id":null,"source_url":"http://s3.amazonaws.com/uploader-media.getchute.com/uploads/RExUbEE2dHMdq2NzEiya2KlHzNIe0XnO/RExUbEE2dHMdq2NzEiya2KlHzNIe0XnOtest_image.jpg","service":null,"import_id":null,"import_url":null},"service":"uploaded","user":{"id":6426969,"links":{"self":{"href":"http://api.getchute.com/v2/users/6426969","title":"User
|
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.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chute Corporation
|
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
238
|
version: '0'
|
239
239
|
requirements: []
|
240
240
|
rubyforge_project:
|
241
|
-
rubygems_version: 2.
|
241
|
+
rubygems_version: 2.6.10
|
242
242
|
signing_key:
|
243
243
|
specification_version: 4
|
244
244
|
summary: Chute API SDK
|