bobot 4.9.0 → 4.10.0
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 +4 -4
- data/lib/bobot/error_parser.rb +3 -1
- data/lib/bobot/exceptions.rb +2 -0
- data/lib/bobot/graph_facebook.rb +6 -4
- data/lib/bobot/page.rb +1 -1
- data/lib/bobot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96d820253c2aec245e7d653195f88974e44b1d6dd7ef2d7ac00159742d9a8c1d
|
4
|
+
data.tar.gz: e5d357af5e7509716509000977650b63cb2fd76533ab0cfe4facdff90add1fae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50823cab814e752d9f5d2ceb9a749532610b409469bc2fc0b1cc198a6311d421320d5ad57cae3bb199b8a93d7adc1b9e11ae6327457a338cce96c9f630f856be
|
7
|
+
data.tar.gz: f773b18d07c34be70ec3d6c2826c5cb308121e04b3e912653d94f17b687f425b8c0b3f92f53a7b60689b22508f1202bb0789e66b5c8a97d0e38dcf345a754efb
|
data/lib/bobot/error_parser.rb
CHANGED
@@ -35,7 +35,7 @@ module Bobot
|
|
35
35
|
# response - A HTTParty::Response object.
|
36
36
|
#
|
37
37
|
# Returns nil if no errors were found, otherwises raises appropriately
|
38
|
-
def raise_errors_from(response)
|
38
|
+
def raise_errors_from(response, extras = {})
|
39
39
|
return false unless response.key?('error')
|
40
40
|
|
41
41
|
error = response['error']
|
@@ -43,6 +43,8 @@ module Bobot
|
|
43
43
|
error_code = error['code']
|
44
44
|
error_subcode = error['error_subcode']
|
45
45
|
|
46
|
+
error['extras'] = extras
|
47
|
+
|
46
48
|
raise_code_only_error(error_code, error) if error_subcode.nil?
|
47
49
|
|
48
50
|
raise_code_subcode_error(error_code, error_subcode, error)
|
data/lib/bobot/exceptions.rb
CHANGED
@@ -20,6 +20,7 @@ module Bobot
|
|
20
20
|
attr_reader :user_title
|
21
21
|
attr_reader :user_msg
|
22
22
|
attr_reader :fbtrace_id
|
23
|
+
attr_reader :extras
|
23
24
|
|
24
25
|
def initialize(error)
|
25
26
|
@message = error['message']
|
@@ -29,6 +30,7 @@ module Bobot
|
|
29
30
|
@user_title = error['error_user_title']
|
30
31
|
@user_msg = error['error_user_msg']
|
31
32
|
@fbtrace_id = error['fbtrace_id']
|
33
|
+
@extras = error['extras']
|
32
34
|
end
|
33
35
|
|
34
36
|
def to_s
|
data/lib/bobot/graph_facebook.rb
CHANGED
@@ -27,10 +27,11 @@ module Bobot
|
|
27
27
|
|
28
28
|
def graph_post(path, query: {}, body: {})
|
29
29
|
url = "#{GRAPH_FB_URL}#{path}".freeze
|
30
|
+
graph_body = ActiveSupport::JSON.encode(body)
|
30
31
|
response = ::Typhoeus::Request.post(
|
31
32
|
url,
|
32
33
|
params: URI.encode_www_form(query.reverse_merge(include_headers: false)),
|
33
|
-
body:
|
34
|
+
body: graph_body,
|
34
35
|
headers: GRAPH_HEADERS,
|
35
36
|
ssl_verifypeer: false,
|
36
37
|
)
|
@@ -39,17 +40,18 @@ module Bobot
|
|
39
40
|
Rails.logger.debug "[POST] >> #{url}"
|
40
41
|
Rails.logger.debug "[POST] << #{json}"
|
41
42
|
end
|
42
|
-
Bobot::ErrorParser.raise_errors_from(json)
|
43
|
+
Bobot::ErrorParser.raise_errors_from(json, graph_body)
|
43
44
|
json
|
44
45
|
end
|
45
46
|
module_function :graph_post
|
46
47
|
|
47
48
|
def graph_delete(path, query: {}, body: {})
|
48
49
|
url = "#{GRAPH_FB_URL}#{path}".freeze
|
50
|
+
graph_body = ActiveSupport::JSON.encode(body)
|
49
51
|
response = ::Typhoeus::Request.delete(
|
50
52
|
url,
|
51
53
|
params: URI.encode_www_form(query.reverse_merge(include_headers: false)),
|
52
|
-
body:
|
54
|
+
body: graph_body,
|
53
55
|
headers: GRAPH_HEADERS,
|
54
56
|
ssl_verifypeer: false,
|
55
57
|
)
|
@@ -58,7 +60,7 @@ module Bobot
|
|
58
60
|
Rails.logger.debug "[DELETE] >> #{url}"
|
59
61
|
Rails.logger.debug "[DELETE] << #{json}"
|
60
62
|
end
|
61
|
-
Bobot::ErrorParser.raise_errors_from(json)
|
63
|
+
Bobot::ErrorParser.raise_errors_from(json, graph_body)
|
62
64
|
json
|
63
65
|
end
|
64
66
|
module_function :graph_delete
|
data/lib/bobot/page.rb
CHANGED
data/lib/bobot/version.rb
CHANGED