koala 1.11.0 → 1.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/changelog.md +6 -0
- data/lib/koala/errors.rb +3 -3
- data/lib/koala/version.rb +1 -1
- data/spec/cases/error_spec.rb +6 -6
- 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: 44887034b965ebbac49df6389117a3482918a215
|
4
|
+
data.tar.gz: 0e49cb623168d97da705aed316df81eb7a1dfebf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27f94913be28e196b58ff0934611007025f9374b0f08c3925dc6ce66670493f6dc06c7c6907c22b437765215435fd177b7f858c288466dfa1aa424eae3107344
|
7
|
+
data.tar.gz: f58743aef73431532ca4a8e206ede00abaf43522b5c1e6638f4cd8e4d2a74277661ca1a20f2911fb3aac57309879c10be66561e5b5d30dbbdd5c07664da564f9
|
data/.travis.yml
CHANGED
data/changelog.md
CHANGED
data/lib/koala/errors.rb
CHANGED
@@ -14,7 +14,7 @@ module Koala
|
|
14
14
|
# http_status, then the error was detected before making a call to Facebook. (e.g. missing access token)
|
15
15
|
class APIError < ::Koala::KoalaError
|
16
16
|
attr_accessor :fb_error_type, :fb_error_code, :fb_error_subcode, :fb_error_message,
|
17
|
-
:
|
17
|
+
:fb_error_user_msg, :fb_error_user_title, :http_status, :response_body
|
18
18
|
|
19
19
|
# Create a new API Error
|
20
20
|
#
|
@@ -51,11 +51,11 @@ module Koala
|
|
51
51
|
self.fb_error_code = error_info["code"]
|
52
52
|
self.fb_error_subcode = error_info["error_subcode"]
|
53
53
|
self.fb_error_message = error_info["message"]
|
54
|
-
self.
|
54
|
+
self.fb_error_user_msg = error_info["error_user_msg"]
|
55
55
|
self.fb_error_user_title = error_info["error_user_title"]
|
56
56
|
|
57
57
|
error_array = []
|
58
|
-
%w(type code error_subcode message error_user_title
|
58
|
+
%w(type code error_subcode message error_user_title error_user_msg).each do |key|
|
59
59
|
error_array << "#{key}: #{error_info[key]}" if error_info[key]
|
60
60
|
end
|
61
61
|
|
data/lib/koala/version.rb
CHANGED
data/spec/cases/error_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Koala::Facebook::APIError do
|
|
5
5
|
expect(Koala::Facebook::APIError.new(nil, nil)).to be_a(Koala::KoalaError)
|
6
6
|
end
|
7
7
|
|
8
|
-
[:fb_error_type, :fb_error_code, :fb_error_subcode, :fb_error_message, :
|
8
|
+
[:fb_error_type, :fb_error_code, :fb_error_subcode, :fb_error_message, :fb_error_user_msg, :fb_error_user_title, :http_status, :response_body].each do |accessor|
|
9
9
|
it "has an accessor for #{accessor}" do
|
10
10
|
expect(Koala::Facebook::APIError.instance_methods.map(&:to_sym)).to include(accessor)
|
11
11
|
expect(Koala::Facebook::APIError.instance_methods.map(&:to_sym)).to include(:"#{accessor}=")
|
@@ -28,7 +28,7 @@ describe Koala::Facebook::APIError do
|
|
28
28
|
'message' => 'message',
|
29
29
|
'code' => 1,
|
30
30
|
'error_subcode' => 'subcode',
|
31
|
-
'
|
31
|
+
'error_user_msg' => 'error user message',
|
32
32
|
'error_user_title' => 'error user title'
|
33
33
|
}
|
34
34
|
Koala::Facebook::APIError.new(400, '', error_info)
|
@@ -39,7 +39,7 @@ describe Koala::Facebook::APIError do
|
|
39
39
|
:fb_error_message => 'message',
|
40
40
|
:fb_error_code => 1,
|
41
41
|
:fb_error_subcode => 'subcode',
|
42
|
-
:
|
42
|
+
:fb_error_user_msg => 'error user message',
|
43
43
|
:fb_error_user_title => 'error user title'
|
44
44
|
}.each_pair do |accessor, value|
|
45
45
|
it "sets #{accessor} to #{value}" do
|
@@ -48,7 +48,7 @@ describe Koala::Facebook::APIError do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "sets the error message appropriately" do
|
51
|
-
expect(error.message).to eq("type: type, code: 1, error_subcode: subcode, message: message, error_user_title: error user title,
|
51
|
+
expect(error.message).to eq("type: type, code: 1, error_subcode: subcode, message: message, error_user_title: error user title, error_user_msg: error user message [HTTP 400]")
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -62,14 +62,14 @@ describe Koala::Facebook::APIError do
|
|
62
62
|
|
63
63
|
context "with no error_info and a response_body containing error JSON" do
|
64
64
|
it "should extract the error info from the response body" do
|
65
|
-
response_body = '{ "error": { "type": "type", "message": "message", "code": 1, "error_subcode": "subcode", "
|
65
|
+
response_body = '{ "error": { "type": "type", "message": "message", "code": 1, "error_subcode": "subcode", "error_user_msg": "error user message", "error_user_title": "error user title" } }'
|
66
66
|
error = Koala::Facebook::APIError.new(400, response_body)
|
67
67
|
{
|
68
68
|
:fb_error_type => 'type',
|
69
69
|
:fb_error_message => 'message',
|
70
70
|
:fb_error_code => 1,
|
71
71
|
:fb_error_subcode => 'subcode',
|
72
|
-
:
|
72
|
+
:fb_error_user_msg => 'error user message',
|
73
73
|
:fb_error_user_title => 'error user title'
|
74
74
|
}.each_pair do |accessor, value|
|
75
75
|
expect(error.send(accessor)).to eq(value)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: koala
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Koppel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|