fb_graph_ruby 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 095108092c98e78fe8530d44b1b75f1048f7f479
4
- data.tar.gz: 5bbc30673b1fc410ba85559cadfdabae32af89ef
3
+ metadata.gz: 7770c1ed5ef8dc21cb1939f627143926cc6fb814
4
+ data.tar.gz: 53d48f5530b65e927bfc3d393d295e0f9fcb43d4
5
5
  SHA512:
6
- metadata.gz: e4b1ecbea8fa29e07b610cd4048d954ff2dd32e263eaa529f3c7ae027ac0c7d3f27e3eef00f3ad2ba44aeae24796876ada30ca9b35c82c2b7f2bc40de179a136
7
- data.tar.gz: e572af804e56ae5e0fc099170c0c749c7bd6e5b8e28d968a57398c47ef8f6cb5d022b21b15b6c88ee9e3bad87e32b66e668d6907bc4e1f70469ea60553c4a0a5
6
+ metadata.gz: c9d47c31355e0372175a4afc9855fd0b83458af4771e54ac48d939b5a20e95b18eea542915796e28af0dab9336663ce17178204f1bc750bc30e2de6b4afaa700
7
+ data.tar.gz: 601f5e7a6d41fe0c8262dea9108beb99852fc7ffd922dc7886da81b4f0701e8e70954a9d9441dea78578a1b9f659a166aa53acd71dd851452a84d3887aaf46b3
@@ -2,13 +2,28 @@ require 'fb_graph_ruby/version'
2
2
  require 'httparty'
3
3
 
4
4
  module FbGraphRuby
5
- class Base
6
5
 
7
- def self.ping
8
- puts 'Pong'
6
+ class Messenger
7
+
8
+ def self.get_profile(fb_id, access_token)
9
+ uri = "https://graph.facebook.com/v2.9/#{fb_id}"
10
+ query = { fields: 'first_name,last_name,locale,timezone,gender',
11
+ access_token: access_token}
12
+ HTTParty.get(uri,
13
+ query: query).parsed_response
14
+ end
15
+
16
+ def self.send_message(fb_id, payload, access_token)
17
+ uri = 'https://graph.facebook.com/v2.9/me/messages'
18
+ query = { access_token: access_token }
19
+ headers = { 'Content-Type' => 'application/json' }
20
+ body = {
21
+ recipient: { id: fb_id },
22
+ message: payload
23
+ }.to_json
24
+ HTTParty.post(uri, query: query, headers: headers, body: body).parsed_response
9
25
  end
10
26
 
11
27
  end
12
- end
13
28
 
14
- load 'lib/fb_graph_ruby/messenger.rb'
29
+ end
@@ -1,3 +1,3 @@
1
1
  module FbGraphRuby
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Zhuk
@@ -86,7 +86,6 @@ files:
86
86
  - bin/setup
87
87
  - fb_graph_ruby.gemspec
88
88
  - lib/fb_graph_ruby.rb
89
- - lib/fb_graph_ruby/messenger.rb
90
89
  - lib/fb_graph_ruby/version.rb
91
90
  homepage: https://github.com/ZhuChara2004/fb_graph_ruby
92
91
  licenses:
@@ -1,23 +0,0 @@
1
- module FbGraphRuby
2
- class Messenger < Base
3
-
4
- def self.get_profile(fb_id, access_token)
5
- uri = "https://graph.facebook.com/v2.9/#{fb_id}"
6
- query = { fields: 'first_name,last_name,locale,timezone,gender',
7
- access_token: access_token}
8
- HTTParty.get(uri,
9
- query: query).parsed_response
10
- end
11
-
12
- def self.send_message(fb_id, payload, access_token)
13
- uri = 'https://graph.facebook.com/v2.9/me/messages'
14
- query = { access_token: access_token }
15
- headers = { 'Content-Type' => 'application/json' }
16
- body = {
17
- recipient: { id: fb_id },
18
- message: payload
19
- }.to_json
20
- HTTParty.post(uri, query: query, headers: headers, body: body).parsed_response
21
- end
22
- end
23
- end