stealth-facebook 0.10.3 → 0.11.0

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
  SHA256:
3
- metadata.gz: bbfeaca3d399ac98bcfeefd3134c4f08b5d1977c401fbe7be84507748f6d847b
4
- data.tar.gz: c4b29d59dd6fff49568bd8fdbb3eeca1d5bdc444d4d48b44c0d8d590c1771a8c
3
+ metadata.gz: bf2ef304f3c6e483aa969d7978ec498c5aab684f8a6d2f4060df92b8cf592eaf
4
+ data.tar.gz: ffb4f5b2d8e8186fd4d8ccc210878dc8765796b0cf4a722853edf5692911d092
5
5
  SHA512:
6
- metadata.gz: fd82b5e8f63fc0ede67bf0599db7bd7350866fcbab00b07f8a61717d481cc6cd66615528d259b088c46f65683e00a20042650c565f36b2ca0cbe4fe1e3363ab0
7
- data.tar.gz: 9b92469017d47b6e128f5962762e77226168c05f8dfca949c07950790ba3c90bcdc28674e5e452257462ad916a480d566a9b6fd70915301a3936d1767fb05cd7
6
+ metadata.gz: f848d03ed2e5b7c2b692c04592051891e0adba30e8259110122b633bcd4e60a1026e534006b0fa4dd60edcb0713155654b848c406f77a8c3b2eabac8e59f36dd
7
+ data.tar.gz: fcbf1093cefaa3797bc3e85a421ee7742169eb499fe6035ad13491b503ba830ff82317726bc6132d57fb852b01da96e8294a26dc10b13187446c0a74acafce92
data/README.md CHANGED
@@ -93,6 +93,39 @@ Each time you make a change to the persistent menu, you will have to upload the
93
93
  stealth setup facebook
94
94
  ```
95
95
 
96
+ ### Profile Data
97
+
98
+ By default, your Facebook bots may retrieve the `id`, `name`, `first_name`, `last_name`, and `profile_pic` fields for users that have made this information public and have opted-in to your bot. More info [here](https://developers.facebook.com/docs/messenger-platform/identity/user-profile).
99
+
100
+ To fetch a user's profile with `stealth-facebook` you can call the following:
101
+
102
+ ```ruby
103
+ fb_profile = Stealth::Services::Facebook::Client.fetch_profile(
104
+ recipient_id: current_user_id
105
+ )
106
+ ```
107
+
108
+ `fb_profile` is a hash that contains the fields above:
109
+
110
+ ```ruby
111
+ {
112
+ 'id' => 1464633220279330,
113
+ 'name' => "Carol Robbins",
114
+ 'first_name' => "Carol",
115
+ 'last_name' => "Robbins",
116
+ 'profile_pic' => "https://platform-lookaside.fbsbx.com/platform/profilepic/?psid=1464633220279330&width=1024&ext=1537650777&hash=AeQzWeTgFqlAyiye"
117
+ }
118
+ ```
119
+
120
+ If your bot has permission to retrieve additional fields, you can specify them as an array of symbols via the `fields` argument:
121
+
122
+ ```ruby
123
+ fb_profile = Stealth::Services::Facebook::Client.fetch_profile(
124
+ recipient_id: current_user_id,
125
+ fields: [:id, :name, :first_name, :last_name, :profile_pic, :gender, :locale]
126
+ )
127
+ ```
128
+
96
129
  ## Replies
97
130
 
98
131
  Here are the supported replies for the Facebook integration:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.3
1
+ 0.11.0
@@ -30,7 +30,7 @@ module Stealth
30
30
 
31
31
  def self.fetch_profile(recipient_id:, fields: nil)
32
32
  if fields.blank?
33
- fields = [:first_name, :last_name, :profile_pic, :locale, :timezone, :gender, :is_payment_enabled, :last_ad_referral]
33
+ fields = [:id, :name, :first_name, :last_name, :profile_pic]
34
34
  end
35
35
 
36
36
  query_hash = {
@@ -40,7 +40,7 @@ module Stealth
40
40
 
41
41
  uri = URI::HTTPS.build(
42
42
  host: "graph.facebook.com",
43
- path: "/v2.12/#{recipient_id}",
43
+ path: "/#{recipient_id}",
44
44
  query: query_hash.to_query
45
45
  )
46
46
 
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.10.3
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauricio Gomes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-20 00:00:00.000000000 Z
11
+ date: 2018-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stealth