instagram 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,6 +31,12 @@ module FaradayMiddleware
31
31
  end
32
32
 
33
33
  def error_body(body)
34
+ # body gets passed as a string, not sure if it is passed as something else from other spots?
35
+ if not body.nil? and not body.empty? and body.kind_of?(String)
36
+ # removed multi_json thanks to wesnolte's commit
37
+ body = ::JSON.parse(body)
38
+ end
39
+
34
40
  if body.nil?
35
41
  nil
36
42
  elsif body['meta'] and body['meta']['error_message'] and not body['meta']['error_message'].empty?
@@ -1,3 +1,3 @@
1
1
  module Instagram
2
- VERSION = '0.8.3'.freeze unless defined?(::Instagram::VERSION)
2
+ VERSION = '0.8.4'.freeze unless defined?(::Instagram::VERSION)
3
3
  end
@@ -23,6 +23,20 @@ describe Faraday::Response do
23
23
  @client.user_media_feed()
24
24
  end.should raise_error(exception)
25
25
  end
26
+
27
+ end
28
+ end
29
+
30
+ context "when a 400 is raised" do
31
+ before do
32
+ stub_get('users/self/feed.json').
33
+ to_return(:body => '{"meta":{"error_message": "Bad words are bad."}}', :status => 400)
34
+ end
35
+
36
+ it "should return the body error message" do
37
+ expect do
38
+ @client.user_media_feed()
39
+ end.should raise_error(Instagram::BadRequest, /Bad words are bad./)
26
40
  end
27
41
  end
28
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instagram
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-25 00:00:00.000000000Z
12
+ date: 2012-05-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70311601093360 !ruby/object:Gem::Requirement
16
+ requirement: &70234824417720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.4'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70311601093360
24
+ version_requirements: *70234824417720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: webmock
27
- requirement: &70311601092260 !ruby/object:Gem::Requirement
27
+ requirement: &70234824416580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.6'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70311601092260
35
+ version_requirements: *70234824416580
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bluecloth
38
- requirement: &70311601091380 !ruby/object:Gem::Requirement
38
+ requirement: &70234824415400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.0.11
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70311601091380
46
+ version_requirements: *70234824415400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: faraday
49
- requirement: &70311601090160 !ruby/object:Gem::Requirement
49
+ requirement: &70234824414280 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.7'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70311601090160
57
+ version_requirements: *70234824414280
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: faraday_middleware
60
- requirement: &70311601089040 !ruby/object:Gem::Requirement
60
+ requirement: &70234824413220 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0.8'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70311601089040
68
+ version_requirements: *70234824413220
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: multi_json
71
- requirement: &70311601087820 !ruby/object:Gem::Requirement
71
+ requirement: &70234824411780 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.3
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70311601087820
79
+ version_requirements: *70234824411780
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: hashie
82
- requirement: &70311601086700 !ruby/object:Gem::Requirement
82
+ requirement: &70234824410420 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 0.4.0
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70311601086700
90
+ version_requirements: *70234824410420
91
91
  description: A Ruby wrapper for the Instagram REST and Search APIs
92
92
  email:
93
93
  - shayne@instagr.am
@@ -189,7 +189,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
189
  version: '0'
190
190
  segments:
191
191
  - 0
192
- hash: -68303577616785186
192
+ hash: 794823889550936591
193
193
  required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  none: false
195
195
  requirements: