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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2244287b3fa8e6d2e733f52d0a17b77e35212992d317bbc1ce604a3a1acd77f6
4
- data.tar.gz: be3fbff646eec7ce45e9679a7b3daa28ec427e3af237a458e75dce577a656f86
3
+ metadata.gz: 96d820253c2aec245e7d653195f88974e44b1d6dd7ef2d7ac00159742d9a8c1d
4
+ data.tar.gz: e5d357af5e7509716509000977650b63cb2fd76533ab0cfe4facdff90add1fae
5
5
  SHA512:
6
- metadata.gz: 1d10996b8dcdda72a19e3ae0b7e65fbcbf5db2d2e99d12c95d50b7768dbe91f5f0147638ae366afbace21d9f86f456dc27bb9a91153dba7fa6a10ec83f3bdd4c
7
- data.tar.gz: 94a6d4e3093fdc49b01b5a8343d35e78d1c144c25a882dbda9387487c36be401cd5f6753b8a8404bc8ccc4ea0f2b2f8538f40d935b4cee168e3b544ed5076d75
6
+ metadata.gz: 50823cab814e752d9f5d2ceb9a749532610b409469bc2fc0b1cc198a6311d421320d5ad57cae3bb199b8a93d7adc1b9e11ae6327457a338cce96c9f630f856be
7
+ data.tar.gz: f773b18d07c34be70ec3d6c2826c5cb308121e04b3e912653d94f17b687f425b8c0b3f92f53a7b60689b22508f1202bb0789e66b5c8a97d0e38dcf345a754efb
@@ -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)
@@ -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
@@ -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: ActiveSupport::JSON.encode(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: ActiveSupport::JSON.encode(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
@@ -75,7 +75,7 @@ module Bobot
75
75
  raise Bobot::FieldFormat.new('text size is limited to 640.', "#{text} (#{text.size} chars)") if text.size > 640
76
76
  send(
77
77
  payload_message: {
78
- text: text,
78
+ texto: text,
79
79
  },
80
80
  to: to,
81
81
  messaging_options: messaging_options,
@@ -1,7 +1,7 @@
1
1
  module Bobot
2
2
  class Version
3
3
  MAJOR = 4
4
- MINOR = 9
4
+ MINOR = 10
5
5
  PATCH = 0
6
6
  PRE = nil
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bobot
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Navid EMAD