chute 2.2.0 → 2.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3495db2763a7d259675a69a069fac218eff1e4d
4
- data.tar.gz: e663fd0116d0d112bc4f9fa166c1f1e9a5e0f5b8
3
+ metadata.gz: 7b91ab61d2e4c1c36936d64eb195e86837551c15
4
+ data.tar.gz: 0a39778b784e9cab3957ba85b026e55662660c4f
5
5
  SHA512:
6
- metadata.gz: b77e63b51e72ab4434d4ed052cdfbfc27b207f69630383c4e30f47352ae4656d74afe859ca79b3c25c38d7a7c557157d43ce9647277c3cda1a9574bf25075137
7
- data.tar.gz: aa7022770b0a66bbea317da124d1f9216e5d9d18f239816f79acfc977efbf9318328fd065998be6113c99d8ef37b21cbbff6dd1128331fcf7fe27174727d7dbd
6
+ metadata.gz: aec1ef988c041dc23a10b9934221081a59999b0f260d83aa1d517bb8ebd24a0e158d6d07f7a5d2f5bf02551304a746b86c147642a83f4f07b6824bfa1462f373
7
+ data.tar.gz: b000178c7b6158242a40b62defbb6050178051311a560dbd6fd8e8fe07032bb60db136b8576ea75287278cac44f62e92ff168389ca68107fe2bebb3d9088ae8f
@@ -6,7 +6,7 @@
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "chute"
9
- s.version = "2.2.0"
9
+ s.version = "2.2.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -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 = 'http://upload.getchute.com'
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
@@ -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.new('Chute API Exception')
37
+ raise ChuteApiInternalException, "Chute API Exception. #{ex.message}"
45
38
  rescue Exception => ex
46
39
  p 'Unknown Error'
47
40
  raise
@@ -2,7 +2,7 @@ module Chute
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 2
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -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: http://upload.getchute.com/v2/albums/2443331/assets/upload
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":"http://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
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.0
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.4.6
241
+ rubygems_version: 2.6.10
242
242
  signing_key:
243
243
  specification_version: 4
244
244
  summary: Chute API SDK