fb_graph2 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/VERSION +1 -1
- data/fb_graph2.gemspec +1 -1
- data/lib/fb_graph2.rb +8 -8
- data/lib/fb_graph2/app.rb +17 -12
- data/lib/fb_graph2/auth.rb +1 -1
- data/lib/fb_graph2/conversation.rb +0 -1
- data/lib/fb_graph2/edge/messages.rb +4 -4
- data/lib/fb_graph2/edge/ratings.rb +12 -0
- data/lib/fb_graph2/node.rb +2 -1
- data/lib/fb_graph2/page.rb +2 -1
- data/lib/fb_graph2/struct/context.rb +6 -0
- data/lib/fb_graph2/struct/rating.rb +12 -0
- data/lib/fb_graph2/util.rb +1 -1
- data/spec/fb_graph2/edge/ratings_spec.rb +18 -0
- data/spec/fb_graph2/node_spec.rb +1 -1
- data/spec/mock_json/page/ratings.json +42 -0
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b2b9b9ad7cc7f2a67a303299d8e7c5cf5ebe340
|
4
|
+
data.tar.gz: 63f1e3cf00cb81bd7bef711ca63a4d95df3cff9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e565d948fbdd173babbdf36ee32c7cadb063c9f06e26d6de5b8bb8fdf37380cd844c03dad45f754f8cb2f7f7a95831dc4e1138bcc036774e051838035299bf90
|
7
|
+
data.tar.gz: b25b43d048747bf8c276d5a04ed2aba6cf25d82068bc2b599e204daa29ec9e812875a15f86c0a36c605b8a7258bf81f987bddb162077fde3ef2bd049afb80ae6
|
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
data/fb_graph2.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.require_paths = ['lib']
|
15
15
|
|
16
16
|
gem.add_runtime_dependency 'httpclient', '>= 2.4'
|
17
|
-
gem.add_runtime_dependency 'rack-oauth2', '>= 1.
|
17
|
+
gem.add_runtime_dependency 'rack-oauth2', '>= 1.1'
|
18
18
|
gem.add_runtime_dependency 'url_safe_base64'
|
19
19
|
gem.add_runtime_dependency 'multi_json'
|
20
20
|
gem.add_runtime_dependency 'activesupport', '>= 3.2'
|
data/lib/fb_graph2.rb
CHANGED
@@ -7,7 +7,7 @@ module FbGraph2
|
|
7
7
|
|
8
8
|
self.root_url = 'https://graph.facebook.com'
|
9
9
|
self.api_version = 'v2.0'
|
10
|
-
self.gem_version = File.read(File.join(__dir__, '../VERSION')).
|
10
|
+
self.gem_version = File.read(File.join(__dir__, '../VERSION')).strip
|
11
11
|
self.logger = Logger.new(STDOUT)
|
12
12
|
self.logger.progname = 'FbGraph2'
|
13
13
|
self.object_classes = Array.new
|
@@ -40,14 +40,14 @@ module FbGraph2
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
require_relative 'fb_graph2/exception'
|
44
|
+
require_relative 'fb_graph2/attribute_assigner'
|
45
|
+
require_relative 'fb_graph2/node'
|
46
|
+
require_relative 'fb_graph2/collection'
|
47
|
+
require_relative 'fb_graph2/searchable'
|
48
|
+
require_relative 'fb_graph2/edge'
|
49
49
|
[
|
50
|
-
'
|
50
|
+
'',
|
51
51
|
'request_filter'
|
52
52
|
].each do |dir|
|
53
53
|
Dir[File.join(__dir__, 'fb_graph2', dir, '*.rb')].each do |file|
|
data/lib/fb_graph2/app.rb
CHANGED
@@ -11,30 +11,35 @@ module FbGraph2
|
|
11
11
|
include Edge::Scores
|
12
12
|
include Edge::StaticResources
|
13
13
|
include Edge::Subscriptions
|
14
|
-
include Edge::TestUsers
|
14
|
+
include Edge::TestUsers # called "accounts" edge on Graph API Doc.
|
15
15
|
include Edge::Translations
|
16
16
|
|
17
17
|
register_attributes(
|
18
18
|
raw: [
|
19
|
-
:android_key_hash, :app_domains, :
|
20
|
-
:auth_dialog_perms_explanation, :
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
19
|
+
:android_key_hash, :app_domains, :app_events_feature_bitmask, :app_name, :app_type, :auth_dialog_data_help_url,
|
20
|
+
:auth_dialog_headline, :auth_dialog_perms_explanation, :auth_referral_default_activity_privacy, :auth_referral_enabled,
|
21
|
+
:auth_referral_extended_perms, :auth_referral_friend_perms, :auth_referral_response_type, :auth_referral_user_perms,
|
22
|
+
:canvas_fluid_height, :canvas_fluid_width, :canvas_url, :category, :client_config, :company, :configured_ios_sso,
|
23
|
+
:contact_email, :creator_uid, :daily_active_users, :daily_active_users_rank, :deauth_callback_url, :description,
|
24
|
+
:hosting_url, :icon_url, :ios_bundle_id, :ios_supports_system_auth, :ipad_app_store_id, :iphone_app_store_id,
|
25
|
+
:link, :logo_url, :migrations, :mobile_profile_section_url, :mobile_web_url, :monthly_active_users, :monthly_active_users_rank,
|
26
|
+
:name, :namespace, :page_tab_default_name, :page_tab_url, :privacy_policy_url, :profile_section_url, :secure_canvas_url,
|
27
|
+
:secure_page_tab_url, :server_ip_whitelist, :social_discovery, :subcategory, :supports_attribution, :supports_implicit_sdk_logging,
|
28
|
+
:suppress_native_ios_gdp, :terms_of_service_url, :url_scheme_suffix, :use_legacy_auth, :user_support_email, :user_support_url,
|
29
|
+
:website_url, :weekly_active_users, :gdpv4_enabled, :gdpv4_nux_enabled, :gdpv4_nux_content
|
28
30
|
],
|
29
31
|
timestamp: [:created_time],
|
30
32
|
custom: [
|
31
|
-
:
|
32
|
-
:
|
33
|
+
:android_sdk_error_categories, :context, :ios_sdk_error_categories, :object_store_urls, :restrictions,
|
34
|
+
:supports_apprequests_fast_app_switch
|
33
35
|
]
|
34
36
|
)
|
35
37
|
|
36
38
|
def initialize(id, attributes = {})
|
37
39
|
super
|
40
|
+
if attributes.include? :context
|
41
|
+
self.context = Struct::Context::AppContext.new attributes[:context]
|
42
|
+
end
|
38
43
|
# TODO: handle custom attributes.
|
39
44
|
end
|
40
45
|
|
data/lib/fb_graph2/auth.rb
CHANGED
@@ -10,10 +10,10 @@ module FbGraph2
|
|
10
10
|
|
11
11
|
def messages(params = {})
|
12
12
|
messages = if @_cached_messages.present? && params.blank?
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
@_cached_messages
|
14
|
+
else
|
15
|
+
self.edge :messages, params
|
16
|
+
end
|
17
17
|
messages.collect! do |message|
|
18
18
|
Message.new(message[:id], message).authenticate self.access_token
|
19
19
|
end
|
data/lib/fb_graph2/node.rb
CHANGED
@@ -94,6 +94,7 @@ module FbGraph2
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def build_params(params = {})
|
97
|
+
params = Hash(params).merge(debug: :all) if FbGraph2.debugging?
|
97
98
|
if params.present?
|
98
99
|
if params.include? :fields
|
99
100
|
params[:fields] = Array(params[:fields]).join(',')
|
@@ -122,4 +123,4 @@ module FbGraph2
|
|
122
123
|
raise Exception.new(response.status, "Unparsable Response: #{response.body}")
|
123
124
|
end
|
124
125
|
end
|
125
|
-
end
|
126
|
+
end
|
data/lib/fb_graph2/page.rb
CHANGED
@@ -16,6 +16,7 @@ module FbGraph2
|
|
16
16
|
include Edge::Photos
|
17
17
|
include Edge::Posts
|
18
18
|
include Edge::PromotablePosts
|
19
|
+
include Edge::Ratings
|
19
20
|
include Edge::Roles::PageContext
|
20
21
|
include Edge::Settings
|
21
22
|
include Edge::Statuses
|
@@ -79,4 +80,4 @@ module FbGraph2
|
|
79
80
|
end
|
80
81
|
end
|
81
82
|
end
|
82
|
-
end
|
83
|
+
end
|
data/lib/fb_graph2/util.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FbGraph2::Edge::Ratings do
|
4
|
+
let(:page) { FbGraph2::Page.new('page_id').authenticate('page_token') }
|
5
|
+
|
6
|
+
describe '#ratings' do
|
7
|
+
it 'should return an Array of FbGraph2::Struct::Rating' do
|
8
|
+
ratings = mock_graph :get, 'page_id/ratings', 'page/ratings', access_token: 'page_token' do
|
9
|
+
page.ratings
|
10
|
+
end
|
11
|
+
ratings.should be_instance_of FbGraph2::Edge
|
12
|
+
ratings.should_not be_blank
|
13
|
+
ratings.each do |rating|
|
14
|
+
rating.should be_instance_of FbGraph2::Struct::Rating
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/fb_graph2/node_spec.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
{
|
2
|
+
"data": [
|
3
|
+
{
|
4
|
+
"created_time": "2014-10-13T02:04:49+0000",
|
5
|
+
"reviewer": {
|
6
|
+
"id": "10206374744997522",
|
7
|
+
"name": "Shigeru Takagaki"
|
8
|
+
},
|
9
|
+
"rating": 5
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"created_time": "2014-07-09T13:39:31+0000",
|
13
|
+
"reviewer": {
|
14
|
+
"id": "585838138182211",
|
15
|
+
"name": "Teruko Kaneshiro"
|
16
|
+
},
|
17
|
+
"rating": 5
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"created_time": "2013-11-10T08:21:29+0000",
|
21
|
+
"reviewer": {
|
22
|
+
"id": "10152917500568292",
|
23
|
+
"name": "Lyn Yeoh"
|
24
|
+
},
|
25
|
+
"rating": 5
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"created_time": "2013-07-08T11:28:20+0000",
|
29
|
+
"reviewer": {
|
30
|
+
"id": "10152167763779825",
|
31
|
+
"name": "Hayashi Tatsuya"
|
32
|
+
},
|
33
|
+
"rating": 5
|
34
|
+
}
|
35
|
+
],
|
36
|
+
"paging": {
|
37
|
+
"cursors": {
|
38
|
+
"before": "MTUzNDY1MDA1NzoxMzkyOTYxMDYwOTU4Mjk=",
|
39
|
+
"after": "NzcyNjg5ODI0OjEzOTI5NjEwNjA5NTgyOQ=="
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
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.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov matake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: url_safe_base64
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,6 +233,7 @@ files:
|
|
233
233
|
- lib/fb_graph2/edge/pokes.rb
|
234
234
|
- lib/fb_graph2/edge/posts.rb
|
235
235
|
- lib/fb_graph2/edge/promotable_posts.rb
|
236
|
+
- lib/fb_graph2/edge/ratings.rb
|
236
237
|
- lib/fb_graph2/edge/refunds.rb
|
237
238
|
- lib/fb_graph2/edge/roles.rb
|
238
239
|
- lib/fb_graph2/edge/scores.rb
|
@@ -294,6 +295,7 @@ files:
|
|
294
295
|
- lib/fb_graph2/struct/poke.rb
|
295
296
|
- lib/fb_graph2/struct/privacy.rb
|
296
297
|
- lib/fb_graph2/struct/property.rb
|
298
|
+
- lib/fb_graph2/struct/rating.rb
|
297
299
|
- lib/fb_graph2/struct/restaurant_services.rb
|
298
300
|
- lib/fb_graph2/struct/restaurant_specialties.rb
|
299
301
|
- lib/fb_graph2/struct/role.rb
|
@@ -354,6 +356,7 @@ files:
|
|
354
356
|
- spec/fb_graph2/edge/pokes_spec.rb
|
355
357
|
- spec/fb_graph2/edge/posts_spec.rb
|
356
358
|
- spec/fb_graph2/edge/promotable_posts_spec.rb
|
359
|
+
- spec/fb_graph2/edge/ratings_spec.rb
|
357
360
|
- spec/fb_graph2/edge/roles_spec.rb
|
358
361
|
- spec/fb_graph2/edge/scores_spec.rb
|
359
362
|
- spec/fb_graph2/edge/settings_spec.rb
|
@@ -400,6 +403,7 @@ files:
|
|
400
403
|
- spec/mock_json/page/milestones.json
|
401
404
|
- spec/mock_json/page/offers.json
|
402
405
|
- spec/mock_json/page/promotable_posts.json
|
406
|
+
- spec/mock_json/page/ratings.json
|
403
407
|
- spec/mock_json/page/roles.json
|
404
408
|
- spec/mock_json/page/roles_single.json
|
405
409
|
- spec/mock_json/page/settings.json
|