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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5bb39956c63a81088235822b5b6859f6010e6974
4
- data.tar.gz: 63d1315b27dfa5bc4af79950bbe17d2cb5599871
3
+ metadata.gz: 3b2b9b9ad7cc7f2a67a303299d8e7c5cf5ebe340
4
+ data.tar.gz: 63f1e3cf00cb81bd7bef711ca63a4d95df3cff9a
5
5
  SHA512:
6
- metadata.gz: 5eddbfa8f5409d0f99cf6e0af07cd8921be2345b0ffebf5168a854de3c894b1f62ca27b5ebf81e7b1b0cf1ce436953e236b204985d8690532d42c84b081f2b17
7
- data.tar.gz: 61ba1c2b63262ddeb685912544639c3a1315880b8e516185d283445c5089aff4b02d5e22ebb32e82a81f67387066b77e0539dd90da54c3b92e9f54e972162611
6
+ metadata.gz: e565d948fbdd173babbdf36ee32c7cadb063c9f06e26d6de5b8bb8fdf37380cd844c03dad45f754f8cb2f7f7a95831dc4e1138bcc036774e051838035299bf90
7
+ data.tar.gz: b25b43d048747bf8c276d5a04ed2aba6cf25d82068bc2b599e204daa29ec9e812875a15f86c0a36c605b8a7258bf81f987bddb162077fde3ef2bd049afb80ae6
@@ -1,3 +1,4 @@
1
1
  rvm:
2
2
  - 2.0.0
3
- - 2.1.2
3
+ - 2.1.5
4
+ - 2.2.0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
@@ -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.0'
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'
@@ -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')).delete("\n\r")
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
- require 'fb_graph2/exception'
44
- require 'fb_graph2/attribute_assigner'
45
- require 'fb_graph2/node'
46
- require 'fb_graph2/collection'
47
- require 'fb_graph2/searchable'
48
- require 'fb_graph2/edge'
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|
@@ -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, :auth_dialog_data_help_url, :auth_dialog_headline,
20
- :auth_dialog_perms_explanation, :auth_referral_enabled, :auth_referral_extended_perms,
21
- :auth_referral_friend_perms, :auth_referral_user_perms, :canvas_fluid_height, :canvas_fluid_width,
22
- :canvas_url, :category, :company, :contact_email, :creator_uid, :daily_active_users, :daily_active_users_rank,
23
- :deauth_callback_url, :description, :hosting_url, :icon_url, :ios_bundle_id, :iphone_app_store_id,
24
- :link, :logo_url, :mobile_web_url, :monthly_active_users, :monthly_active_users_rank, :name,
25
- :namespace, :page_tab_default_name, :page_tab_url, :privacy_policy_url, :secure_canvas_url,
26
- :secure_page_tab_url, :server_ip_whitelist, :social_discovery, :subcategory, :terms_of_service_url,
27
- :user_support_email, :user_support_url, :website_url, :weekly_active_users
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
- :auth_referral_default_activity_privacy, :auth_referral_response_type, :context, :migrations,
32
- :object_store_urls, :restrictions
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
 
@@ -56,4 +56,4 @@ end
56
56
 
57
57
  Dir[File.join(__dir__, 'auth/*.rb')].each do |file|
58
58
  require file
59
- end
59
+ end
@@ -1,7 +1,6 @@
1
1
  module FbGraph2
2
2
  class Conversation < Node
3
3
  include Edge::Messages
4
-
5
4
  register_attributes(
6
5
  raw: [:snippet, :message_count, :unread_count, :can_reply, :is_subscribed],
7
6
  time: [:updated_time],
@@ -10,10 +10,10 @@ module FbGraph2
10
10
 
11
11
  def messages(params = {})
12
12
  messages = if @_cached_messages.present? && params.blank?
13
- @_cached_messages
14
- else
15
- self.edge :messages, params
16
- end
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
@@ -0,0 +1,12 @@
1
+ module FbGraph2
2
+ class Edge
3
+ module Ratings
4
+ def ratings(params = {})
5
+ ratings = self.edge :ratings, params
6
+ ratings.collect! do |rating|
7
+ Struct::Rating.new rating
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -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
@@ -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
@@ -13,6 +13,12 @@ module FbGraph2
13
13
  users: [:friends_who_like, :friends_tagged_at, :music_listen_friends, :video_watch_friends]
14
14
  )
15
15
  end
16
+
17
+ class AppContext < Struct
18
+ register_attributes(
19
+ users: [:friends_using_app]
20
+ )
21
+ end
16
22
  end
17
23
  end
18
24
  end
@@ -0,0 +1,12 @@
1
+ module FbGraph2
2
+ class Struct
3
+ class Rating < Struct
4
+ register_attributes(
5
+ raw: [:has_rating, :has_review, :rating, :review_text],
6
+ datetime: [:created_time],
7
+ user: [:reviewer],
8
+ custom: [:open_graph_story]
9
+ )
10
+ end
11
+ end
12
+ end
@@ -10,4 +10,4 @@ module FbGraph2
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -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
@@ -168,4 +168,4 @@ describe FbGraph2::Node do
168
168
  end
169
169
  end
170
170
  end
171
- end
171
+ end
@@ -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.1
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-01 00:00:00.000000000 Z
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.0'
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.0'
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