fb_graph2 0.9.1 → 1.0.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
  SHA1:
3
- metadata.gz: 02d3fd73078b36678b448d41403a317d79a04d97
4
- data.tar.gz: 2308ec4a9c5332e8ef7849a9433b65b2f7aae0de
3
+ metadata.gz: '0738fbe0b5b3cb5b5d1d3c0e1665bed4f8bc8478'
4
+ data.tar.gz: 804976e5eb887955df2104029ba682e03fe34978
5
5
  SHA512:
6
- metadata.gz: 074d72daff605881499997e72d2a4bf66d2e9bd8a9f87f1e63b78a526f68b8c285b9f5da22200e0f1a707db3987cad0d3ed079aff94d8a311b0a14d92153ce07
7
- data.tar.gz: 0732424c4b42690745067661f04b4cfea43df05daba9dcf64ebd017df435d236e192eb04385f01bdede167b24d7fcbbea1c62bb6fa7e86c6e2e5a673d89c3e0b
6
+ metadata.gz: 9ffc445f032ece020e0b490d7182d5194da1f049d555f1ae763161121f1b22d9cef0f8c0568f84ac32679d38804f8e21bf151bb0f27e3d4aef05bad55ce87e50
7
+ data.tar.gz: 422b1607ae11a5566bb860358ad4b8a329a8c9e6e6df082d13b03c96052157b2a3b1d18cd20ff25d55fedcec7ba15a7379903f0948d3ca447ded3d63179f9d9d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.1
1
+ 1.0.0
@@ -8,7 +8,7 @@ module FbGraph2
8
8
  mattr_accessor :root_url, :api_version, :gem_version, :logger, :debugging, :_http_config_, :object_classes
9
9
 
10
10
  self.root_url = 'https://graph.facebook.com'
11
- self.api_version = 'v2.8'
11
+ self.api_version = 'v2.10'
12
12
  self.gem_version = File.read(File.join(__dir__, '../VERSION')).strip
13
13
  self.logger = Logger.new(STDOUT)
14
14
  self.logger.progname = 'FbGraph2'
@@ -1,5 +1,7 @@
1
1
  module FbGraph2
2
2
  class Auth < Rack::OAuth2::Client
3
+ attr_required :client_code_endpoint
4
+
3
5
  class Grant
4
6
  class FbExchangeToken < Rack::OAuth2::Client::Grant
5
7
  attr_required :fb_exchange_token
@@ -12,7 +14,8 @@ module FbGraph2
12
14
  secret: client_secret,
13
15
  host: URI.parse(FbGraph2.root_url).host,
14
16
  authorization_endpoint: File.join('/', FbGraph2.api_version, '/oauth/authorize'),
15
- token_endpoint: File.join('/', FbGraph2.api_version, '/oauth/access_token')
17
+ token_endpoint: File.join('/', FbGraph2.api_version, '/oauth/access_token'),
18
+ client_code_endpoint: File.join('/', FbGraph2.api_version, '/oauth/client_code')
16
19
  )
17
20
  end
18
21
 
@@ -30,6 +33,26 @@ module FbGraph2
30
33
  raise Exception.detect(e.status, e.response)
31
34
  end
32
35
 
36
+ def client_code!(access_token, options = {})
37
+ params = {
38
+ access_token: access_token,
39
+ client_id: identifier,
40
+ client_secret: secret,
41
+ redirect_uri: redirect_uri
42
+ }.merge(options)
43
+ response = Rack::OAuth2.http_client.post(
44
+ absolute_uri_for(client_code_endpoint),
45
+ params
46
+ )
47
+ response_json = JSON.parse(response.body).with_indifferent_access
48
+ case response.status
49
+ when 200..201
50
+ response_json
51
+ else
52
+ raise Exception.detect(response.status, response_json)
53
+ end
54
+ end
55
+
33
56
  def debug_token!(input_token)
34
57
  token_metadata = TokenMetadata.new
35
58
  token_metadata.authenticate access_token!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-29 00:00:00.000000000 Z
11
+ date: 2017-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -474,7 +474,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
474
474
  version: '0'
475
475
  requirements: []
476
476
  rubyforge_project:
477
- rubygems_version: 2.6.8
477
+ rubygems_version: 2.6.13
478
478
  signing_key:
479
479
  specification_version: 4
480
480
  summary: Facebook Graph API v2.x Wrapper in Ruby