Class: MessageQuickly::Api::UserProfile

Inherits:
Base
  • Object
show all
Defined in:
lib/message_quickly/api/user_profile.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

client, #initialize

Constructor Details

This class inherits a constructor from MessageQuickly::Api::Base

Class Method Details

.find(id) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/message_quickly/api/user_profile.rb', line 5

def self.find(id)
  # curl -X GET "https://graph.facebook.com/v2.6/<USER_ID>?fields=first_name,last_name,profile_pic&access_token=<PAGE_ACCESS_TOKEN>"
  # {
  #   "first_name": "Peter",
  #   "last_name": "Chang",
  #   "profile_pic": "https://fbcdn-profile-a.akamaihd.net/hprofile...70ec9c19b18"
  # }
  UserProfile.new.find(id)
end

Instance Method Details

#find(id) ⇒ Object



15
16
17
18
# File 'lib/message_quickly/api/user_profile.rb', line 15

def find(id)
  json = @client.get(id, { fields: 'first_name,last_name,profile_pic,locale,timezone,gender' })
  Messaging::User.new(json)
end