stealth-facebook 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb2add5ca870baf50a9dd8dd5e55ebe4625051f8
4
- data.tar.gz: 0b880e4057e9c5445facfa83801d02c5788335fa
3
+ metadata.gz: 623bfb431fd35b3322b7e80a5320ca5a09765a00
4
+ data.tar.gz: 7c4baa89550a9122952aaa5809c2d7e97d9ec6b7
5
5
  SHA512:
6
- metadata.gz: 9ef0ef7851238ce6c4f6d0b17231695d9f146ceb172285dda30141c38875605f883d0c6d566bcb75b030dde6219d27de3b5861f1bb43e2e43c5ace53011ff9aa
7
- data.tar.gz: 69cee3ec475fcaacda34d63b1732aaac5259f21d2a9d3f1ffe8b42b463b57fd16cc58fa623c1a903c5fdb2757c4d8be1812900da70c141f6d067bed7304b4901
6
+ metadata.gz: b7042402fa0c4c9ecb3b50e3038f63fba4fb0d60b1eaf8c0ab3444d227900eea056c457165248708f34a90f6b2de0e30617afc9e8e518b6f468bd6c8c46fd143
7
+ data.tar.gz: d26b7a101e41547024a12c536126885411374e8dda85884c2226fe57e053a6a3f5a184ecdda4e00ba763018e9f76835f8b0cc5ca4298da625fe9cda030bf7b36
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.1
1
+ 0.9.2
@@ -33,7 +33,7 @@ module Stealth
33
33
  fields = [:first_name, :last_name, :profile_pic, :locale, :timezone, :gender, :is_payment_enabled, :last_ad_referral]
34
34
  end
35
35
 
36
- query_hash ={
36
+ query_hash = {
37
37
  fields: fields.join(','),
38
38
  access_token: Stealth.config.facebook.page_access_token
39
39
  }
@@ -50,7 +50,7 @@ module Stealth
50
50
  if response.status.in?(200..299)
51
51
  MultiJson.load(response.body)
52
52
  else
53
- false
53
+ raise(Stealth::Errors::ServiceError, "Facebook error #{response.status}: #{response.body}")
54
54
  end
55
55
  end
56
56
  end
@@ -31,19 +31,24 @@ module Stealth
31
31
  end
32
32
 
33
33
  def fetch_location
34
- if params['location'].present?
35
- lat = params['location']['coordinates']['lat']
36
- lng = params['location']['coordinates']['long']
37
- service_message.location = {
38
- lat: lat,
39
- lng: lng
40
- }
34
+ if params['message']['attachments'].present? && params['message']['attachments'].is_a?(Array)
35
+ params['message']['attachments'].each do |attachment|
36
+ next unless attachment['type'] == 'location'
37
+
38
+ lat = attachment['payload']['coordinates']['lat']
39
+ lng = attachment['payload']['coordinates']['long']
40
+
41
+ service_message.location = {
42
+ lat: lat,
43
+ lng: lng
44
+ }
45
+ end
41
46
  end
42
47
  end
43
48
 
44
49
  def fetch_attachments
45
- if params['attachments'].present? && params['attachments'].is_a?(Array)
46
- params['attachments'].each do |attachment|
50
+ if params['message']['attachments'].present? && params['message']['attachments'].is_a?(Array)
51
+ params['message']['attachments'].each do |attachment|
47
52
  service_message.attachments << {
48
53
  type: attachment['type'],
49
54
  url: attachment['payload']['url']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stealth-facebook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauricio Gomes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-08 00:00:00.000000000 Z
11
+ date: 2017-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stealth
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.6.12
128
+ rubygems_version: 2.6.11
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Stealth Facebook Messenger driver