facebook_ads 0.1.7 → 0.1.8

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: f8117b9273b5c021539acebd28147725fc64aa5b
4
- data.tar.gz: 9896c67db75495e96eddcce3e0a26740223fd1a4
3
+ metadata.gz: 61b7ae96792b4405ed2bffbe93924ab38f8df935
4
+ data.tar.gz: 453fe5ce1681754ceea78981ca341404352e72ac
5
5
  SHA512:
6
- metadata.gz: 30e04d2e719a14ba63d7886acb557d05061f997e00d09fe0b566af53d772867b4f3100c944c7bc3e7db0ad220225ee42502f0afa6385c158c6b5a399bffbe069
7
- data.tar.gz: 167e49f93ac8c9d18cf13aa2b753a3b57795aabd172030490baabdf9fd61df2b2ab99a2b85f322a905be33dca78b926d44affc1f916534f9a9564636cb8c5764
6
+ metadata.gz: 11b7686efbfd515073db8feaecd384ddc8a3e51fbf15ce9b000775fb77654d5aa8a2ca0456b98d7586fe702204bff0e5289646b726d8ae4b01783bbe7e1a80dd
7
+ data.tar.gz: a64588d63ce45b8bef1ebd064d6ec2acb263b030a3426c5a9e6c06b4fc82cafefe847600e62834b8357844229437c9ecfb45abafa4e3a5dc2f8fa9ba5bc94af7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- facebook_ads (0.1.7)
4
+ facebook_ads (0.1.8)
5
5
  hashie (~> 3.4)
6
6
  rest-client (>= 1.6)
7
7
 
@@ -78,4 +78,4 @@ DEPENDENCIES
78
78
  webmock
79
79
 
80
80
  BUNDLED WITH
81
- 1.13.6
81
+ 1.13.7
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/facebook_ads.svg)](https://badge.fury.io/rb/facebook_ads)
2
- [![Build Status](https://travis-ci.org/cte/facebook-ads-sdk-ruby.svg?branch=master)](https://travis-ci.org/cte/facebook-ads-sdk-ruby)
3
- [![Coverage Status](https://coveralls.io/repos/github/cte/facebook-ads-sdk-ruby/badge.svg)](https://coveralls.io/github/cte/facebook-ads-sdk-ruby)
2
+ [![Build Status](https://travis-ci.org/cte/facebook-ruby-ads-sdk.svg?branch=master)](https://travis-ci.org/cte/facebook-ruby-ads-sdk)
3
+ [![Coverage Status](https://coveralls.io/repos/github/cte/facebook-ruby-ads-sdk/badge.svg?branch=master)](https://coveralls.io/github/cte/facebook-ruby-ads-sdk?branch=master)
4
4
 
5
5
  # [Facebook Marketing API](https://developers.facebook.com/docs/marketing-apis) SDK for Ruby
6
6
 
data/facebook_ads.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # To release a new version:
2
2
  # gem build facebook_ads.gemspec
3
- # gem push facebook_ads-0.1.7.gem
3
+ # gem push facebook_ads-0.1.8.gem
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'facebook_ads'
6
- s.version = '0.1.7'
6
+ s.version = '0.1.8'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.licenses = ['MIT']
9
9
  s.authors = ['Chris Estreich']
@@ -99,7 +99,7 @@ module FacebookAds
99
99
  end
100
100
  end
101
101
 
102
- raise Exception, "Invalid response: #{response.inspect}" unless response.is_a?(Hash)
102
+ raise Exception, "Invalid response: #{response.class.name} #{response.inspect}" unless response.is_a?(Hash)
103
103
  raise Exception, "[#{response['error']['code']}] #{response['error']['message']} - raw response: #{response.inspect}" unless response['error'].nil?
104
104
  return response unless objectify
105
105
 
@@ -147,13 +147,6 @@ module FacebookAds
147
147
  end
148
148
  end
149
149
 
150
- def update(data)
151
- return false if data.nil?
152
- response = self.class.post("/#{id}", query: data, objectify: false)
153
- raise Exception, "Invalid response from update: #{response.inspect}" unless @response.is_a?(Hash) && response.key?('success')
154
- response['success']
155
- end
156
-
157
150
  def save
158
151
  return nil if changes.nil? || changes.length.zero?
159
152
  data = {}
@@ -162,9 +155,14 @@ module FacebookAds
162
155
  self.class.find(id)
163
156
  end
164
157
 
158
+ def update(data)
159
+ return false if data.nil?
160
+ response = self.class.post("/#{id}", query: data, objectify: false)
161
+ response['success']
162
+ end
163
+
165
164
  def destroy(path: nil, query: {})
166
165
  response = self.class.delete(path || "/#{id}", query: query)
167
- raise Exception, "Invalid response from destroy: #{response.inspect}" unless response.key?('success')
168
166
  response['success']
169
167
  end
170
168
 
data/test/ad_set_test.rb CHANGED
@@ -2,6 +2,10 @@ require 'test_helper'
2
2
 
3
3
  # rake test TEST=test/ad_set_test.rb
4
4
  class AdSetTest < BaseTest
5
- def test_foo
5
+ def test_update
6
+ vcr do
7
+ ad_set = FacebookAds::AdSet.find('6078462927057')
8
+ assert ad_set.update(daily_budget: 149900)
9
+ end
6
10
  end
7
11
  end
@@ -0,0 +1,134 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://graph.facebook.com/v2.8/6078462927057?access_token=TEST_ACCESS_TOKEN&fields=id,account_id,campaign_id,adlabels,adset_schedule,bid_amount,bid_info,billing_event,configured_status,created_time,creative_sequence,effective_status,end_time,frequency_cap,frequency_cap_reset_period,frequency_control_specs,is_autobid,lifetime_frequency_cap,lifetime_imps,name,optimization_goal,promoted_object,rf_prediction_id,rtb_flag,start_time,targeting,updated_time,use_new_app_click,pacing_type,budget_remaining,daily_budget,lifetime_budget
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - rest-client/2.0.0 (darwin16.3.0 x86_64) ruby/2.2.6p396
16
+ Host:
17
+ - graph.facebook.com
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Etag:
26
+ - '"8601e585e51a79f062fca560a52d6ba20e8851b7"'
27
+ Pragma:
28
+ - no-cache
29
+ Cache-Control:
30
+ - private, no-cache, no-store, must-revalidate
31
+ Facebook-Api-Version:
32
+ - v2.8
33
+ Expires:
34
+ - Sat, 01 Jan 2000 00:00:00 GMT
35
+ Content-Type:
36
+ - application/json; charset=UTF-8
37
+ X-Fb-Trace-Id:
38
+ - FYcH7oOq7ZO
39
+ X-Fb-Rev:
40
+ - '2768927'
41
+ Vary:
42
+ - Accept-Encoding
43
+ Content-Encoding:
44
+ - gzip
45
+ X-Fb-Debug:
46
+ - CL6Z+QJWxmHr07ulS7RrqdZdh78jeQvyOfW5Ir+rvu8wXWB70O9Fxhr3flqxI79ZaZHtjEJGlQ340bvOE1CK4A==
47
+ Date:
48
+ - Mon, 09 Jan 2017 12:06:46 GMT
49
+ Connection:
50
+ - keep-alive
51
+ Content-Length:
52
+ - '820'
53
+ body:
54
+ encoding: ASCII-8BIT
55
+ string: !binary |-
56
+ H4sIAAAAAAAAA41UwW7jNhD9FYGnLmAtKMqSJd1crxc12iaL2M4etgFBS5TC
57
+ miJZisrGDfLvHVK2kW23aG8SZ/jmzbw3fEGiQRXK8aKY56QkC5wt0Ayxutaj
58
+ cjQEE5wlZVokSZEUpMA+XrPeMNEperkNkZzgbLp9EFIK1VH+xJWD+ObXT3fr
59
+ 7XZze7P1d7VqRTda3tDBMTcOkLFc7Tb3ax+0nDmIONFzOCc4yeMkiUm6S5IK
60
+ LyqSxLjAGDJ52/LaiSf+HZTW8j9GruoTrZmhlg/cUcOt0MAWz5AYKBudPnjy
61
+ zo58hqRouS9JRW+GkKNYIPCZH6KlMcxyGZHfRoxJFpEszsroc3Sv5djz6EfR
62
+ NNwO0aZnHR+iJHlP0vdJDjS0AUzxJ3NCK9ppJgHw9uPH7Wa3pqvbm/v13WUm
63
+ xupe+7714XfoClUvyIhnLs8CzBekKEqCvUBp4buvx8HpfpowdSfjuW5uNrvN
64
+ crf+QFc/rVc/3+536HWGrDvQVrIOVS2TA/QK47LufwwY0joYiuo8G2iN9uwZ
65
+ VVk5m36EQhXJ4McYKhSAShmU8KhKu8sZb7xWz7UcG2jvTJuNjQB5OIz6y8vk
66
+ QJIWc5KRsiyzHKacZOiqwYcTfIh6OTZRHC2l9IJEd7wTg+Pgomg/wPih1X8g
67
+ kTT7DyQv778j5TgvynK+KAkJvj6jwMU4ZMbT9EiME/T6cBXlO935/UrLDOfp
68
+ /C3SL1ofmRRHHv2w384uBnsH5PbbaBXQvLPiKMVRw06TuYg3ly/XceWNB1VI
69
+ +NNU6jqYbfCShQ22ItBA+y2CnEs8OCacP0IF4GN57Vf14XXKkSFI5rP84Y0P
70
+ 6Fs/A3v+bJgaPBzo7E08HqQYHrmlRjLXatuHEi2r+QEa9c/KeTJUcfdV26Pn
71
+ dAlTowdxJg+XeDCOFd2jo49MgXX8tik4C8YC14OLRS25x2j4kwDUb8r2sN/S
72
+ 99bw4ei0Cc2Npvnb87IA8WJc7vC8wqRK0ov7x8Gz/Eq9vWsp6uN1fwyr/TCm
73
+ pfvi10k1zDaex2FsYFTw4PRMqLA5sLtpPveSN0zIE50y/HmGcSh0fXquIYxe
74
+ /wJPAx7ClwUAAA==
75
+ http_version:
76
+ recorded_at: Mon, 09 Jan 2017 12:06:46 GMT
77
+ - request:
78
+ method: post
79
+ uri: https://graph.facebook.com/v2.8/6078462927057
80
+ body:
81
+ encoding: UTF-8
82
+ string: daily_budget=149900&access_token=TEST_ACCESS_TOKEN
83
+ headers:
84
+ Accept:
85
+ - "*/*"
86
+ Accept-Encoding:
87
+ - gzip, deflate
88
+ User-Agent:
89
+ - rest-client/2.0.0 (darwin16.3.0 x86_64) ruby/2.2.6p396
90
+ Content-Length:
91
+ - '205'
92
+ Content-Type:
93
+ - application/x-www-form-urlencoded
94
+ Host:
95
+ - graph.facebook.com
96
+ response:
97
+ status:
98
+ code: 200
99
+ message: OK
100
+ headers:
101
+ P3p:
102
+ - 'CP="Facebook does not have a P3P policy. Learn why here: http://fb.me/p3p"'
103
+ Access-Control-Allow-Origin:
104
+ - "*"
105
+ Pragma:
106
+ - no-cache
107
+ Cache-Control:
108
+ - private, no-cache, no-store, must-revalidate
109
+ Facebook-Api-Version:
110
+ - v2.8
111
+ Expires:
112
+ - Sat, 01 Jan 2000 00:00:00 GMT
113
+ Content-Type:
114
+ - application/json; charset=UTF-8
115
+ X-Fb-Trace-Id:
116
+ - CHyrZMQDmsR
117
+ X-Fb-Rev:
118
+ - '2768887'
119
+ Set-Cookie:
120
+ - sW=1483963606%3AAaDLso7ysP8SWvGp; path=/; domain=.graph.facebook.com; secure
121
+ X-Fb-Debug:
122
+ - "+T+Zyg61PIrzSH8uyxzxPAUJ6qDnUStygRBXef+Sl6eja/viNiHOnYXRHsxb9z1vrXx8JlB9Ab5bumH7iC+hmw=="
123
+ Date:
124
+ - Mon, 09 Jan 2017 12:06:47 GMT
125
+ Connection:
126
+ - keep-alive
127
+ Content-Length:
128
+ - '16'
129
+ body:
130
+ encoding: UTF-8
131
+ string: '{"success":true}'
132
+ http_version:
133
+ recorded_at: Mon, 09 Jan 2017 12:06:47 GMT
134
+ recorded_with: VCR 3.0.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebook_ads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Estreich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-06 00:00:00.000000000 Z
11
+ date: 2017-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -95,6 +95,7 @@ files:
95
95
  - test/vcr_cassettes/AdProductCatalogTest-test_all.yml
96
96
  - test/vcr_cassettes/AdProductCatalogTest-test_create.yml
97
97
  - test/vcr_cassettes/AdProductTest-test_list.yml
98
+ - test/vcr_cassettes/AdSetTest-test_update.yml
98
99
  homepage: https://github.com/cte/facebook-ruby-ads-sdk
99
100
  licenses:
100
101
  - MIT