adparlor-facebook 0.6.2 → 0.6.3

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: 1fb8aaf86e42ed6c383b6870ed4a79234590c040
4
- data.tar.gz: d5ceb42766341c27a737855c00ff5683866c1a00
3
+ metadata.gz: a513544a2ca0dba181b02abc702c14983536e442
4
+ data.tar.gz: 80c4fde5904088a2fdde1e70e0ab9503090f2e8e
5
5
  SHA512:
6
- metadata.gz: 2e9ee263e10c78a1d7e5044269ef2a2f939b5a7448c9298cde95b8c084a849e8f04af284bbb4106a2227ea6aaed4d0738ffa617d77cd8323737db6e0893b9674
7
- data.tar.gz: 1604d0d47a4d73c4caa3ea3353e7b62dfe6a9a8bd6043b4debdeff67d789d87a9d18878b3eaee3f2bde63db6bd9e9702dc953bcf12a527324c426ee749b293eb
6
+ metadata.gz: fcaa23cbc76627d2c54ba724aaa9b863af7d45efb50f12876fec4f921e1e34c189c74dbebb0c18b9545e3feb56f0673ce4c9e0f6996099c6ca1242b8a303355c
7
+ data.tar.gz: 535c76d9c130c1ca740c25e40bdeec2566170300879d49be1787b4244797dd05d2ae12dd5fdfd6df9c4a562b73dc138034840536a8003afb0ad9d4a7aec6192f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adparlor-facebook (0.6.2)
4
+ adparlor-facebook (0.6.3)
5
5
  faraday
6
6
  faraday_middleware
7
7
  httpclient
@@ -9,13 +9,14 @@ module Adparlor
9
9
 
10
10
  class << self
11
11
  def get(path_or_account_id, options = {})
12
- path = path_or_account_id
13
-
14
- begin
15
- account_id = Integer(path_or_account_id)
16
- path = "/#{normalize_account_id(account_id)}"
17
- rescue
18
- STDERR.puts 'Invalid account id passed to get'
12
+ path = path_or_account_id.to_s
13
+ if !path.include?('adaccounts')
14
+ begin
15
+ account_id = Integer(path_or_account_id)
16
+ path = "/#{normalize_account_id(account_id)}"
17
+ rescue
18
+ STDERR.puts 'Invalid account id passed to get'
19
+ end
19
20
  end
20
21
 
21
22
  super(path, options)
@@ -32,7 +33,11 @@ module Adparlor
32
33
  end
33
34
 
34
35
  def parse_data_for_collection(response)
35
- response['data'].first.last
36
+ if !response['data'].first.is_a?(Hash)
37
+ response['data'].first.last
38
+ else
39
+ response['data']
40
+ end
36
41
  end
37
42
  end
38
43
 
@@ -73,7 +73,7 @@ module Adparlor
73
73
  case
74
74
  when body.key?('data')
75
75
  if body['data'].is_a? Hash
76
- data[index] << @batch_types[index].new(body['data'])
76
+ data[index] << @batch_types[index].new(body['data'])
77
77
  else
78
78
  body['data'].each { |object| data[index] << @batch_types[index].new(object) }
79
79
  if body['paging'] && body['paging']['next']
@@ -10,7 +10,7 @@ module Adparlor
10
10
  :auth_referral_enabled, :auth_referral_extended_perms, :auth_referral_friend_perms,
11
11
  :auth_referral_response_type, :auth_referral_user_perms, :canvas_fluid_height,
12
12
  :canvas_fluid_width, :canvas_url, :category, :client_config, :company,
13
- :configured_ios_sso, :contact_email, :context, :created_time, :creator_uid,
13
+ :configured_ios_sso, :contact_email, :created_time, :creator_uid,
14
14
  :deauth_callback_url,
15
15
  :default_share_mode, :description, :hosting_url, :icon_url, :ios_bundle_id,
16
16
  :ios_sdk_error_categories, :ios_supports_system_auth,
@@ -3,116 +3,7 @@ module Adparlor
3
3
  module GraphApi
4
4
  module Fields
5
5
  module Page
6
- FIELDS = [
7
- :id,
8
- :about,
9
- :access_token,
10
- :ad_campaign,
11
- :affiliation,
12
- :app_id,
13
- :app_links,
14
- :artists_we_like,
15
- :attire,
16
- :awards,
17
- :band_interests,
18
- :band_members,
19
- :best_page,
20
- :bio,
21
- :birthday,
22
- :booking_agent,
23
- :built,
24
- :business,
25
- :can_checkin,
26
- :can_post,
27
- :category,
28
- :category_list,
29
- :company_overview,
30
- :contact_address,
31
- :country_page_likes,
32
- :cover,
33
- :culinary_team,
34
- :current_location,
35
- :description,
36
- :description_html,
37
- :directed_by,
38
- :display_subtext,
39
- :emails,
40
- :features,
41
- :food_styles,
42
- :founded,
43
- :general_info,
44
- :general_manager,
45
- :genre,
46
- :global_brand_page_name,
47
- :global_brand_root_id,
48
- :has_added_app,
49
- :leadgen_tos_accepted,
50
- :hometown,
51
- :hours,
52
- :impressum,
53
- :influences,
54
- :is_always_open,
55
- :is_community_page,
56
- :is_permanently_closed,
57
- :is_published,
58
- :is_unclaimed,
59
- :is_verified,
60
- :link,
61
- :location,
62
- :mission,
63
- :mpg,
64
- :name,
65
- :name_with_location_descriptor,
66
- :network,
67
- :new_like_count,
68
- :offer_eligible,
69
- :parent_page,
70
- :parking,
71
- :payment_options,
72
- :personal_info,
73
- :personal_interests,
74
- :pharma_safety_info,
75
- :phone,
76
- :plot_outline,
77
- :press_contact,
78
- :price_range,
79
- :produced_by,
80
- :products,
81
- # NOTE: Documentation still supports these fields but all requests with them
82
- # are failing. Removing as it is not currently in use in relevant applications
83
- # :promotion_eligible,
84
- # :promotion_ineligible_reason,
85
- :public_transit,
86
- :record_label,
87
- :release_date,
88
- :restaurant_services,
89
- :restaurant_specialties,
90
- :schedule,
91
- :screenplay_by,
92
- :season,
93
- :starring,
94
- :start_info,
95
- :store_location_descriptor,
96
- :store_number,
97
- :studio,
98
- :talking_about_count,
99
- :engagement,
100
- :single_line_address,
101
- :place_type,
102
- :unread_message_count,
103
- :unread_notif_count,
104
- :unseen_message_count,
105
- :username,
106
- :verification_status,
107
- :voip_info,
108
- :website,
109
- :were_here_count,
110
- :written_by,
111
- :featured_video,
112
- :checkins,
113
- :likes,
114
- :members
115
- ]
6
+ FIELDS = [:id, :access_token, :leadgen_tos_accepted, :name].freeze
116
7
  end
117
8
  end
118
9
  end
@@ -3,7 +3,7 @@ module Adparlor
3
3
  module GraphApi
4
4
  module Fields
5
5
  module PageAndPlace
6
- FIELDS = [:id, :name, :name_with_location_descriptor].freeze
6
+ FIELDS = [:id, :access_token, :leadgen_tos_accepted, :name]
7
7
  end
8
8
  end
9
9
  end
@@ -0,0 +1,11 @@
1
+ module Adparlor
2
+ module Facebook
3
+ module GraphApi
4
+ module Fields
5
+ module User
6
+ FIELDS = [:id, :name].freeze
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -11,7 +11,7 @@ module Adparlor
11
11
  end
12
12
 
13
13
  def ads_posts
14
- @ads_posts ||= CollectionProxy.new(Post, "/#{id}/ads_posts", access_token)
14
+ @ads_posts ||= CollectionProxy.new Post, "/#{id}/ads_posts", access_token, nil, include_inline_create: true
15
15
  end
16
16
 
17
17
  def picture
@@ -5,6 +5,26 @@ module Adparlor
5
5
  include Fields::PageAndPlace
6
6
  include Traits::Methods
7
7
  field_attrs FIELDS
8
+
9
+ def promotable_posts
10
+ @promotable_posts ||= CollectionProxy.new(Post, "/#{id}/promotable_posts", access_token)
11
+ end
12
+
13
+ def ads_posts
14
+ @ads_posts ||= CollectionProxy.new Post, "/#{id}/ads_posts", access_token, nil, include_inline_create: true
15
+ end
16
+
17
+ def picture
18
+ @picture ||= CollectionProxy.new(Picture, "/#{id}/picture", access_token)
19
+ end
20
+
21
+ def page_backed_instagram_accounts
22
+ @page_backed_instagram_accounts ||= CollectionProxy.new(InstagramAccount, "/#{id}/page_backed_instagram_accounts", access_token)
23
+ end
24
+
25
+ def leadgen_forms
26
+ @leadgen_forms ||= CollectionProxy.new(LeadgenForm, "/#{id}/leadgen_forms", access_token)
27
+ end
8
28
  end
9
29
  end
10
30
  end
@@ -0,0 +1,24 @@
1
+ module Adparlor
2
+ module Facebook
3
+ module GraphApi
4
+ class User < GraphObject
5
+ include Fields::User
6
+ include Traits::Methods
7
+ field_attrs FIELDS
8
+
9
+ def adaccounts
10
+ @adaccounts ||= CollectionProxy.new AdAccount, "/#{id}/adaccounts", access_token
11
+ end
12
+
13
+ def pages
14
+ @pages ||= CollectionProxy.new PageAndPlace, "/#{id}/accounts", access_token
15
+ end
16
+
17
+ def places
18
+ @places ||= CollectionProxy.new PageAndPlace, "/#{id}/accounts", access_token, nil, is_place: true
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  module Adparlor
2
2
  module Facebook
3
- VERSION = '0.6.2'
3
+ VERSION = '0.6.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adparlor-facebook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kel Stopper
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-08-13 00:00:00.000000000 Z
12
+ date: 2019-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -337,6 +337,7 @@ files:
337
337
  - lib/adparlor/facebook/graph_api/fields/targeting_sentence_line.rb
338
338
  - lib/adparlor/facebook/graph_api/fields/targeting_suggestion.rb
339
339
  - lib/adparlor/facebook/graph_api/fields/targeting_validation.rb
340
+ - lib/adparlor/facebook/graph_api/fields/user.rb
340
341
  - lib/adparlor/facebook/graph_api/fields/user_lead_gen_info.rb
341
342
  - lib/adparlor/facebook/graph_api/fields/video_thumbnail.rb
342
343
  - lib/adparlor/facebook/graph_api/graph_object.rb
@@ -360,6 +361,7 @@ files:
360
361
  - lib/adparlor/facebook/graph_api/targeting_suggestion.rb
361
362
  - lib/adparlor/facebook/graph_api/targeting_validation.rb
362
363
  - lib/adparlor/facebook/graph_api/traits/methods.rb
364
+ - lib/adparlor/facebook/graph_api/user.rb
363
365
  - lib/adparlor/facebook/graph_api/user_lead_gen_info.rb
364
366
  - lib/adparlor/facebook/graph_api/video_thumbnail.rb
365
367
  - lib/adparlor/facebook/version.rb