bobot 4.11.0 → 4.13.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: 72bf69c5428507271d86711a97c155192654ad4df12e1ce634ddf05edd495b80
4
- data.tar.gz: 66be62d624276c1e1d7e5415db01a06d6cfc6aeb8a490c007f8257fab01e521e
3
+ metadata.gz: c644ff98cc478e07c3d43a6b13a58751a4f2d3567a87e630650142a1cb431e5d
4
+ data.tar.gz: de9c6c661ea05bc4a1569b07decee9ead20a8f6b0b87c6834d7fef679db6c4f4
5
5
  SHA512:
6
- metadata.gz: 25e4acbd906962b6155b4e458609fb8abac8a7a730a60363547ac2b7e7d28451777273126e1fcff5ffd87cc16d2a37e8b0febe0790c825f39e5793c2af456a04
7
- data.tar.gz: 979ee8a1b7567d95058935ccd038419d6de5d926144d94f9d2c83a2718ddbe2f1aa9f49159779518e967d5a73e6a0ef3b22ece06871994d2140707b2f1760a86
6
+ metadata.gz: aaac5e7aae79265063939f3741b4999a71fba1484fdc68b426c0dfd277930b3d964df40af6f5caa358edad49fbc78f96eaee0dcd40748588cc12d4ddfba75da9
7
+ data.tar.gz: 8d5471016a06120b0d4ccf1fdfc1ef2483075c761b7f121e221e54973c41f9109b7abe91b702ab434337ece4fbef508d693d5c353253398930c2e826bd1defcf
@@ -13,6 +13,7 @@ module Bobot
13
13
  message_echo
14
14
  message_request
15
15
  policy-enforcement
16
+ pass_thread_control
16
17
  ].freeze
17
18
 
18
19
  include Bobot::GraphFacebook
@@ -36,7 +36,7 @@ module Bobot
36
36
  #
37
37
  # Returns nil if no errors were found, otherwises raises appropriately
38
38
  def raise_errors_from(response, extras = {})
39
- return false unless response.key?('error')
39
+ return false if response.nil? || !response.key?('error')
40
40
 
41
41
  error = response['error']
42
42
 
@@ -21,6 +21,7 @@ module Bobot
21
21
  'referral' => Referral,
22
22
  'message_echo' => MessageEcho,
23
23
  'policy-enforcement' => PolicyEnforcement,
24
+ 'pass_thread_control' => PassThreadControl,
24
25
  }.freeze
25
26
 
26
27
  def self.parse(payload)
@@ -0,0 +1,15 @@
1
+ module Bobot
2
+ module Event
3
+ class PassThreadControl
4
+ include Bobot::Event::Common
5
+
6
+ def new_owner_app_id
7
+ @messaging['pass_thread_control']['new_owner_app_id']
8
+ end
9
+
10
+ def metadata
11
+ @messaging['pass_thread_control']['metadata']
12
+ end
13
+ end
14
+ end
15
+ end
@@ -15,7 +15,8 @@ module Bobot
15
15
  headers: GRAPH_HEADERS,
16
16
  ssl_verifypeer: false,
17
17
  )
18
- json = ActiveSupport::JSON.decode(response.send(:body) || '{}')
18
+ json = (ActiveSupport::JSON.decode(response.send(:body) || '{}') rescue ::JSON::ParserError nil)
19
+ Bobot::ErrorParser.raise_errors_from_html(response, graph_body) if json.nil?
19
20
  unless Rails.env.production?
20
21
  Rails.logger.debug "[GET] >> #{url}"
21
22
  Rails.logger.debug "[GET] << #{json}"
@@ -35,7 +36,8 @@ module Bobot
35
36
  headers: GRAPH_HEADERS,
36
37
  ssl_verifypeer: false,
37
38
  )
38
- json = ActiveSupport::JSON.decode(response.send(:body) || '{}')
39
+ json = (ActiveSupport::JSON.decode(response.send(:body) || '{}') rescue ::JSON::ParserError nil)
40
+ Bobot::ErrorParser.raise_errors_from_html(response, graph_body) if json.nil?
39
41
  unless Rails.env.production?
40
42
  Rails.logger.debug "[POST] >> #{url}"
41
43
  Rails.logger.debug "[POST] << #{json}"
@@ -55,7 +57,8 @@ module Bobot
55
57
  headers: GRAPH_HEADERS,
56
58
  ssl_verifypeer: false,
57
59
  )
58
- json = ActiveSupport::JSON.decode(response.send(:body) || '{}')
60
+ json = (ActiveSupport::JSON.decode(response.send(:body) || '{}') rescue ::JSON::ParserError nil)
61
+ Bobot::ErrorParser.raise_errors_from_html(response, graph_body) if json.nil?
59
62
  unless Rails.env.production?
60
63
  Rails.logger.debug "[DELETE] >> #{url}"
61
64
  Rails.logger.debug "[DELETE] << #{json}"
@@ -1,7 +1,7 @@
1
1
  module Bobot
2
2
  class Version
3
3
  MAJOR = 4
4
- MINOR = 11
4
+ MINOR = 13
5
5
  PATCH = 0
6
6
  PRE = nil
7
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bobot
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.11.0
4
+ version: 4.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Navid EMAD
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-29 00:00:00.000000000 Z
11
+ date: 2019-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -91,6 +91,7 @@ files:
91
91
  - lib/bobot/events/message_echo.rb
92
92
  - lib/bobot/events/message_request.rb
93
93
  - lib/bobot/events/optin.rb
94
+ - lib/bobot/events/pass_thread_control.rb
94
95
  - lib/bobot/events/policy_enforcement.rb
95
96
  - lib/bobot/events/postback.rb
96
97
  - lib/bobot/events/read.rb
@@ -195,8 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
196
  - !ruby/object:Gem::Version
196
197
  version: '0'
197
198
  requirements: []
198
- rubyforge_project:
199
- rubygems_version: 2.7.8
199
+ rubygems_version: 3.0.1
200
200
  signing_key:
201
201
  specification_version: 4
202
202
  summary: Facebook Messenger Bot