fb_graph2 1.0.1 → 1.3.0

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
- SHA1:
3
- metadata.gz: 63d15774e3036ed488afd396f760b41a2aee971c
4
- data.tar.gz: e270f37f8cb7346d6313eff76c15d91753d3e427
2
+ SHA256:
3
+ metadata.gz: 8b78918c26f4bd98699a0850e7a87745cc36624b8302fc6c6407eebf04bff568
4
+ data.tar.gz: 2ad5f7c82abd4fe19e56d67e7bfc71eeb8b764147e255e24550b6e7d23e1ed2f
5
5
  SHA512:
6
- metadata.gz: 4924e0314f385bd91d75aa63508b69c64b5b4f6f84af38e87e296d8d9d59e90a4070580d724c92a0a685d9880d8f62161f397ba09fc735fa9ca652ca2450aa30
7
- data.tar.gz: deb8ef8f448efec281b179e8ae47526397cfd9bb9b118de549da636d511d88fbeb6322371f2e4181fc6ca81dae0dc3dfab612eddcb51b3e5353d8fa399cb1569
6
+ metadata.gz: 8ec2238a424c786bce0c8d7992aad00f599e480be4500427c0b2b36f6667160d668e16b5846f46d2c2fd185cc1df536243f1594feaea20551f6fc95494d14f3c
7
+ data.tar.gz: 28d874e1a551bc4472fc634ca7f23c633500cb067635dc78bc782c0353fa7ef16305aa21a2d8a0d1cc7100f92d5d094056fb060dced8fc414ff57b4a8322239c
data/.travis.yml CHANGED
@@ -2,7 +2,6 @@ before_install:
2
2
  - gem install bundler
3
3
 
4
4
  rvm:
5
- - 2.2.2 # NOTE: 2.2.1 or lower aren't supported by activesupport 5.0, CI isn't needed for such legacy versions.
6
- - 2.2.6
7
- - 2.3.3
8
- - 2.4.0
5
+ - 2.5.8
6
+ - 2.6.6
7
+ - 2.7.2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.3.0
@@ -17,7 +17,6 @@ module FbGraph2
17
17
  end
18
18
 
19
19
  def verify!(client)
20
- digest = OpenSSL::Digest::SHA256.new
21
20
  signature = OpenSSL::HMAC.digest OpenSSL::Digest::SHA256.new, client.secret, @payload_str
22
21
  raise VerificationFailed.new('Verification failed') unless @signature == signature
23
22
  instantiate client
@@ -38,4 +37,4 @@ module FbGraph2
38
37
  end
39
38
  end
40
39
  end
41
- end
40
+ end
@@ -18,11 +18,6 @@ module FbGraph2
18
18
  Message.new(message[:id], message).authenticate self.access_token
19
19
  end
20
20
  end
21
-
22
- def message!(params = {})
23
- message = self.post params, edge: :messages
24
- Message.new(message[:id], params.merge(message)).authenticate self.access_token
25
- end
26
21
  end
27
22
  end
28
23
  end
@@ -0,0 +1,10 @@
1
+ module FbGraph2
2
+ class Edge
3
+ module SendApi
4
+ def message!(params = {})
5
+ message = self.post params, edge: :messages
6
+ Message.new(message[:message_id], params.merge(message)).authenticate self.access_token
7
+ end
8
+ end
9
+ end
10
+ end
@@ -4,6 +4,7 @@ module FbGraph2
4
4
  include Edge::Albums
5
5
  include Edge::Blocked
6
6
  include Edge::Conversations
7
+ include Edge::SendApi
7
8
  include Edge::Events
8
9
  include Edge::Feed
9
10
  include Edge::GlobalBrandChildren
@@ -24,9 +24,11 @@ module FbGraph2
24
24
  def initialize(id, attributes = {})
25
25
  super
26
26
  if attributes.include? :message_tags
27
- self.message_tags = attributes[:message_tags].collect do |message_tag|
28
- TaggedProfile.new message_tag[:id], message_tag
29
- end
27
+ self.message_tags = attributes[:message_tags].values.collect do |message_tags|
28
+ message_tags.collect do |tag|
29
+ TaggedProfile.new tag[:id], tag
30
+ end
31
+ end.flatten
30
32
  end
31
33
  if attributes.include? :privacy
32
34
  self.privacy = Struct::Privacy.new attributes[:privacy]
data/lib/fb_graph2.rb CHANGED
@@ -1,19 +1,36 @@
1
1
  require 'active_support'
2
2
  require 'active_support/core_ext'
3
3
  require 'active_support/concern'
4
+ require 'multi_json'
4
5
  require 'rack/oauth2'
5
6
  require 'patch/rack/oauth2/util'
6
7
 
7
8
  module FbGraph2
8
- mattr_accessor :root_url, :api_version, :gem_version, :logger, :debugging, :_http_config_, :object_classes
9
+ mattr_accessor :gem_version, :logger, :debugging, :_http_config_, :object_classes
9
10
 
10
- self.root_url = 'https://graph.facebook.com'
11
- self.api_version = 'v2.10'
11
+ DEFAULT_ROOT_URL = 'https://graph.facebook.com'
12
+ DEFAULT_API_VERSION = 'v7.0'
12
13
  self.gem_version = File.read(File.join(__dir__, '../VERSION')).strip
13
14
  self.logger = Logger.new(STDOUT)
14
15
  self.logger.progname = 'FbGraph2'
15
16
 
16
17
  class << self
18
+ def root_url
19
+ ::Thread.current['fb_graph2_root_url'] || DEFAULT_ROOT_URL
20
+ end
21
+
22
+ def root_url=(value)
23
+ ::Thread.current['fb_graph2_root_url'] = value
24
+ end
25
+
26
+ def api_version
27
+ ::Thread.current['fb_graph2_api_version'] || DEFAULT_API_VERSION
28
+ end
29
+
30
+ def api_version=(value)
31
+ ::Thread.current['fb_graph2_api_version'] = value
32
+ end
33
+
17
34
  def object_classes
18
35
  FbGraph2::Node.descendants
19
36
  end
@@ -30,6 +47,11 @@ module FbGraph2
30
47
  _http_client_ = HTTPClient.new(
31
48
  agent_name: "FbGraph2 (#{gem_version})"
32
49
  )
50
+
51
+ # NOTE: httpclient gem seems stopped maintaining root certtificate set, use OS default.
52
+ _http_client_.ssl_config.clear_cert_store
53
+ _http_client_.ssl_config.cert_store.set_default_paths
54
+
33
55
  _http_client_.request_filter.delete_if do |filter|
34
56
  filter.is_a? HTTPClient::WWWAuth
35
57
  end
@@ -12,6 +12,7 @@ describe FbGraph2::Edge::Posts do
12
12
  posts.should_not be_blank
13
13
  posts.each do |post|
14
14
  post.should be_instance_of FbGraph2::Post
15
+ post.message_tags.count.should == 2
15
16
  end
16
17
  end
17
18
  end
@@ -6,7 +6,7 @@ describe FbGraph2 do
6
6
 
7
7
  context 'as default' do
8
8
  its(:logger) { should be_a Logger }
9
- its(:api_version) { should == 'v2.8' }
9
+ its(:api_version) { should == 'v7.0' }
10
10
  its(:root_url) { should == 'https://graph.facebook.com' }
11
11
  it { should_not be_debugging }
12
12
  end
@@ -37,4 +37,4 @@ describe FbGraph2 do
37
37
  end
38
38
  end
39
39
  end
40
- end
40
+ end
@@ -12,13 +12,26 @@
12
12
  }]
13
13
  },
14
14
  "message": "Nov Matake test",
15
- "message_tags": [{
16
- "id": "579612276",
17
- "name": "Nov Matake",
18
- "type": "user",
19
- "offset": 0,
20
- "length": 10
21
- }],
15
+ "message_tags": {
16
+ "0": [
17
+ {
18
+ "id": "579612276",
19
+ "name": "Nov Matake",
20
+ "type": "user",
21
+ "offset": 0,
22
+ "length": 10
23
+ }
24
+ ],
25
+ "11": [
26
+ {
27
+ "id": "10153177366617368",
28
+ "name": "Bryan Brunetti",
29
+ "type": "user",
30
+ "offset": 11,
31
+ "length": 14
32
+ }
33
+ ]
34
+ },
22
35
  "actions": [{
23
36
  "name": "Comment",
24
37
  "link": "https://www.facebook.com/579612276/posts/10152483324277277"
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: 1.0.1
4
+ version: 1.3.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-10-05 00:00:00.000000000 Z
11
+ date: 2021-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -233,6 +233,7 @@ files:
233
233
  - lib/fb_graph2/edge/refunds.rb
234
234
  - lib/fb_graph2/edge/roles.rb
235
235
  - lib/fb_graph2/edge/scores.rb
236
+ - lib/fb_graph2/edge/send_api.rb
236
237
  - lib/fb_graph2/edge/settings.rb
237
238
  - lib/fb_graph2/edge/shared_posts.rb
238
239
  - lib/fb_graph2/edge/static_resources.rb
@@ -473,8 +474,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
473
474
  - !ruby/object:Gem::Version
474
475
  version: '0'
475
476
  requirements: []
476
- rubyforge_project:
477
- rubygems_version: 2.6.13
477
+ rubygems_version: 3.1.4
478
478
  signing_key:
479
479
  specification_version: 4
480
480
  summary: Facebook Graph API v2.x Wrapper in Ruby