adroller 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b70f68db5e60c43d61d3e1eabb3c07ceb71725db
4
+ data.tar.gz: 4e6fb61791a8b1009e503a2112b498c41c23a454
5
+ SHA512:
6
+ metadata.gz: 38893a8d653cb7af17aa0127ea798b05cb0640ff1ba1f971c53e44531f04b9a103708d9678066dc0ccd4ec892f6dac6242b12625edc5ab3efa3363b7f7996c60
7
+ data.tar.gz: 0ef1de8d7a826164a94768d0446f1b8fa5e79c6207fdc8f275306298965fb198e011684b856393d67a93d1d2d70deb37807b23c4565e8c8c8cd5d097cd448cd1
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /config/application.yml
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ mkmf.log
data/.rubocop.yml ADDED
@@ -0,0 +1 @@
1
+ inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,10 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2014-10-11 16:09:54 -0400 using RuboCop version 0.26.1.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 3
9
+ Style/Documentation:
10
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in adroller.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,67 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ adroller (0.0.1)
5
+ httparty (~> 0.13.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (4.1.4)
11
+ i18n (~> 0.6, >= 0.6.9)
12
+ json (~> 1.7, >= 1.7.7)
13
+ minitest (~> 5.1)
14
+ thread_safe (~> 0.1)
15
+ tzinfo (~> 1.1)
16
+ addressable (2.3.6)
17
+ byebug (3.4.0)
18
+ columnize (~> 0.8)
19
+ debugger-linecache (~> 1.2)
20
+ slop (~> 3.6)
21
+ columnize (0.8.9)
22
+ crack (0.4.2)
23
+ safe_yaml (~> 1.0.0)
24
+ debugger-linecache (1.2.0)
25
+ diff-lcs (1.2.5)
26
+ factory_girl (4.4.0)
27
+ activesupport (>= 3.0.0)
28
+ httparty (0.13.1)
29
+ json (~> 1.8)
30
+ multi_xml (>= 0.5.2)
31
+ i18n (0.6.11)
32
+ json (1.8.1)
33
+ minitest (5.4.0)
34
+ multi_xml (0.5.5)
35
+ rake (10.4.2)
36
+ rspec (3.0.0)
37
+ rspec-core (~> 3.0.0)
38
+ rspec-expectations (~> 3.0.0)
39
+ rspec-mocks (~> 3.0.0)
40
+ rspec-core (3.0.4)
41
+ rspec-support (~> 3.0.0)
42
+ rspec-expectations (3.0.4)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.0.0)
45
+ rspec-mocks (3.0.4)
46
+ rspec-support (~> 3.0.0)
47
+ rspec-support (3.0.4)
48
+ safe_yaml (1.0.4)
49
+ slop (3.6.0)
50
+ thread_safe (0.3.4)
51
+ tzinfo (1.2.2)
52
+ thread_safe (~> 0.1)
53
+ webmock (1.18.0)
54
+ addressable (>= 2.3.6)
55
+ crack (>= 0.3.2)
56
+
57
+ PLATFORMS
58
+ ruby
59
+
60
+ DEPENDENCIES
61
+ adroller!
62
+ bundler (~> 1.7)
63
+ byebug (~> 3.4, >= 3.4.0)
64
+ factory_girl (~> 4.4, >= 4.4.0)
65
+ rake (~> 10.0)
66
+ rspec (~> 3.0, >= 3.0.0)
67
+ webmock (~> 1.18, >= 1.18.0)
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Adroller: An API Wrapper for AdRoll
2
+ ========
3
+
4
+ ![alt tag](https://upload.wikimedia.org/wikipedia/commons/8/86/AdRoll.png)
5
+
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'adroller'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install adroller
22
+
23
+ ## Usage
24
+
25
+ General Info
26
+ ============
27
+
28
+ API version: v1
29
+
30
+ API base url: https://api.adroll.com/v1/
31
+
32
+ API documentation: https://app.adroll.com/api/v1/docs
33
+
34
+ Setup
35
+ =====
36
+
37
+ Set your API username, password and organization eid in your environment
38
+
39
+ ENV['ADROLL_USERNAME'] = 'Your User Name'
40
+
41
+ ENV['ADROLL_PASSWORD'] = 'Your Password'
42
+
43
+ ENV['ADROLL_ORGANIZATION'] = 'Your Organization eid'
44
+
45
+ Method Calls
46
+ ============
47
+
48
+ This gem uses basic abstraction for the AdRoll services
49
+
50
+ A method call will return a JSON response directly from the api
51
+
52
+ AdRoll::Api::{Endpoint Name}.{Endpoint Method}({Endpoint Parameters})
53
+
54
+ Example
55
+ =========
56
+ params = {
57
+
58
+ name: 'My Advertisable',
59
+
60
+ organization: 'FDS32DFA3DK341B4KAL4RK',
61
+
62
+ set_as_default: true,
63
+
64
+ url: 'http://www.thisisaurl.com',
65
+
66
+ product_name: 'My Product'
67
+
68
+ }
69
+
70
+ advertisable = AdRoll::Api::Advertisable.create(params)
71
+
72
+ => {:name => 'My Advertisable' ... }
data/lib/adroll/ad.rb ADDED
@@ -0,0 +1,64 @@
1
+ require 'adroll/service'
2
+
3
+ module AdRoll
4
+ module Api
5
+ class Ad < AdRoll::Api::Service
6
+ class << self
7
+ def clone(destination_url: nil, name: nil, headline: nil, body: nil)
8
+ params = {
9
+ destination_url: destination_url,
10
+ name: name,
11
+ headline: headline,
12
+ body: body
13
+ }.reject { |_, value| value.nil? }
14
+
15
+ call_api(:post, __method__, params)
16
+ end
17
+
18
+ def create(advertisable:, file:, destination_url: nil, name: nil,
19
+ headline: nil, body: nil, message: nil, product: nil, logo: nil)
20
+ params = {
21
+ advertisable: advertisable,
22
+ file: file,
23
+ destination_url: destination_url,
24
+ name: name,
25
+ headline: headline,
26
+ body: body,
27
+ product: product,
28
+ logo: logo
29
+ }.reject { |_, value| value.nil? }
30
+
31
+ call_api(:post, __method__, params)
32
+ end
33
+
34
+ def edit(ad:, destination_url: nil, name: nil, headline: nil, body: nil)
35
+ params = {
36
+ ad: ad,
37
+ destination_url: destination_url,
38
+ name: name,
39
+ headline: headline,
40
+ body: body
41
+ }.reject { |_, value| value.nil? }
42
+
43
+ call_api(:put, __method__, params)
44
+ end
45
+
46
+ def get(ad:)
47
+ params = {
48
+ ad: ad
49
+ }.reject { |_, value| value.nil? }
50
+
51
+ call_api(:get, __method__, params)
52
+ end
53
+
54
+ def set_outline(ad:)
55
+ params = {
56
+ ad: ad
57
+ }.reject { |_, value| value.nil? }
58
+
59
+ call_api(:get, __method__, params)
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,249 @@
1
+ require 'adroll/service'
2
+
3
+ module AdRoll
4
+ module Api
5
+ class Adgroup < AdRoll::Api::Service
6
+ class << self
7
+ def add_demographic_target(adgroup:, target_min:, min_age:, target_max:, max_age:)
8
+ params = {
9
+ adgroup: adgroup,
10
+ target_min: target_min,
11
+ min_age: min_age,
12
+ target_max: target_max,
13
+ max_age: max_age
14
+ }.reject { |_, value| value.nil? }
15
+
16
+ call_api(:get, __method__, params)
17
+ end
18
+
19
+ def add_placement_target(adgroup:, placement:)
20
+ params = {
21
+ adgroup: adgroup,
22
+ placement: placement
23
+ }.reject { |_, value| value.nil? }
24
+
25
+ call_api(:get, __method__, params)
26
+ end
27
+
28
+ def add_platform_target(adgroup:, type:, os:, os_version:, device:)
29
+ params = {
30
+ adgroup: adgroup,
31
+ type: type,
32
+ os: os,
33
+ os_version: os_version,
34
+ device: device
35
+ }.reject { |_, value| value.nil? }
36
+
37
+ call_api(:get, __method__, params)
38
+ end
39
+
40
+ def add_segments(adgroup:, segments:, is_negative: nil)
41
+ params = {
42
+ adgroup: adgroup,
43
+ segments: segments,
44
+ is_negative: is_negative
45
+ }.reject { |_, value| value.nil? }
46
+
47
+ call_api(:get, __method__, params)
48
+ end
49
+
50
+ def allow_site(ad_format:, site:)
51
+ params = {
52
+ ad_format: ad_format,
53
+ site: site
54
+ }.reject { |_, value| value.nil? }
55
+
56
+ call_api(:get, __method__, params)
57
+ end
58
+
59
+ def approve_ad(adgroup:, ad:)
60
+ params = {
61
+ adgroup: adgroup,
62
+ ad: ad
63
+ }.reject { |_, value| value.nil? }
64
+
65
+ call_api(:get, __method__, params)
66
+ end
67
+
68
+ def clone(adgroup:)
69
+ params = {
70
+ adgroup: adgroup
71
+ }.reject { |_, value| value.nil? }
72
+
73
+ call_api(:get, __method__, params)
74
+ end
75
+
76
+ def create(campaign:, name: nil, ads: nil, positive_segments: nil, negative_segments: nil,
77
+ geo_targets:, geo_targets_countries: nil, geo_targets_regions:)
78
+ params = {
79
+ campaign: campaign,
80
+ name: name,
81
+ ads: ads,
82
+ positive_segments: positive_segments,
83
+ negative_segments: negative_segments,
84
+ geo_targets: geo_targets,
85
+ geo_targets_countries: geo_targets_countries,
86
+ geo_targets_regions: geo_targets_regions
87
+ }.reject { |_, value| value.nil? }
88
+
89
+ call_api(:get, __method__, params)
90
+ end
91
+
92
+ def deselect_ads(adgroup:, ads:)
93
+ params = {
94
+ adgroup: adgroup,
95
+ ads: ads
96
+ }.reject { |_, value| value.nil? }
97
+
98
+ call_api(:get, __method__, params)
99
+ end
100
+
101
+ def edit(campaign:, name: nil, status: nil, ads: nil, positive_segments: nil, negative_segments: nil,
102
+ geo_targets:, geo_targets_countries: nil, geo_targets_regions:)
103
+ params = {
104
+ campaign: campaign,
105
+ name: name,
106
+ status: status,
107
+ ads: ads,
108
+ positive_segments: positive_segments,
109
+ negative_segments: negative_segments,
110
+ geo_targets: geo_targets,
111
+ geo_targets_countries: geo_targets_countries,
112
+ geo_targets_regions: geo_targets_regions
113
+ }.reject { |_, value| value.nil? }
114
+
115
+ call_api(:get, __method__, params)
116
+ end
117
+
118
+ def exclude_site(ad_format:, site:)
119
+ params = {
120
+ ad_format: ad_format,
121
+ site: site
122
+ }.reject { |_, value| value.nil? }
123
+
124
+ call_api(:get, __method__, params)
125
+ end
126
+
127
+ def get(adgroup:)
128
+ params = {
129
+ adgroup: adgroup
130
+ }.reject { |_, value| value.nil? }
131
+
132
+ call_api(:get, __method__, params)
133
+ end
134
+
135
+ def get_ads(adgroup:, is_active: nil, statuses: nil, types: nil, width: nil, height: nil)
136
+ params = {
137
+ adgroup: adgroup,
138
+ is_active: is_active,
139
+ statuses: statuses,
140
+ types: types,
141
+ width: width,
142
+ height: height
143
+ }.reject { |_, value| value.nil? }
144
+
145
+ call_api(:get, __method__, params)
146
+ end
147
+
148
+ def get_geo_targets(adgroup:)
149
+ params = {
150
+ agroup: adgroup
151
+ }.reject { |_, value| value.nil? }
152
+
153
+ call_api(:get, __method__, params)
154
+ end
155
+
156
+ def pause(adgroup:)
157
+ params = {
158
+ adgroup: adgroup
159
+ }.reject { |_, value| value.nil? }
160
+
161
+ call_api(:get, __method__, params)
162
+ end
163
+
164
+ def pause_ad(adgroup:, ad:)
165
+ params = {
166
+ adgroup: adgroup,
167
+ ad: ad
168
+ }.reject { |_, value| value.nil? }
169
+
170
+ call_api(:get, __method__, params)
171
+ end
172
+
173
+ def pause_ads(adgroup:, ads:)
174
+ params = {
175
+ adgroup: adgroup,
176
+ ads: ads
177
+ }.reject { |_, value| value.nil? }
178
+
179
+ call_api(:get, __method__, params)
180
+ end
181
+
182
+ def remove_placement_target(adgroup:, placement:)
183
+ params = {
184
+ adgroup: adgroup,
185
+ placement: placement
186
+ }.reject { |_, value| value.nil? }
187
+
188
+ call_api(:get, __method__, params)
189
+ end
190
+
191
+ def remove_platform_target(adgroup:, type:, os:, os_version:, device:)
192
+ params = {
193
+ adgroup: adgroup,
194
+ type: type,
195
+ os: os,
196
+ os_version: os_version,
197
+ device: device
198
+ }.reject { |_, value| value.nil? }
199
+
200
+ call_api(:get, __method__, params)
201
+ end
202
+
203
+ def remove_segments(adgroup:, segments:)
204
+ params = {
205
+ adgroup: adgroup,
206
+ segments: segments
207
+ }.reject { |_, value| value.nil? }
208
+
209
+ call_api(:get, __method__, params)
210
+ end
211
+
212
+ def select_ads(adgroup:, ads:)
213
+ params = {
214
+ adgroup: adgroup,
215
+ ads: ads
216
+ }.reject { |_, value| value.nil? }
217
+
218
+ call_api(:get, __method__, params)
219
+ end
220
+
221
+ def unpause(adgroup:)
222
+ params = {
223
+ adgroup: adgroup
224
+ }.reject { |_, value| value.nil? }
225
+
226
+ call_api(:get, __method__, params)
227
+ end
228
+
229
+ def unpause_ad(adgroup:, ad:)
230
+ params = {
231
+ adgroup: adgroup,
232
+ ad: ad
233
+ }.reject { |_, value| value.nil? }
234
+
235
+ call_api(:get, __method__, params)
236
+ end
237
+
238
+ def unpause_ads(adgroup:, ads:)
239
+ params = {
240
+ adgroup: adgroup,
241
+ ads: ads
242
+ }.reject { |_, value| value.nil? }
243
+
244
+ call_api(:get, __method__, params)
245
+ end
246
+ end
247
+ end
248
+ end
249
+ end
@@ -0,0 +1,120 @@
1
+ module AdRoll
2
+ module Api
3
+ class Advertisable < AdRoll::Api::Service
4
+ class << self
5
+ def create(name: nil, organization:, set_as_default: false, url: nil, product_name: nil)
6
+ params = {
7
+ name: name,
8
+ organization: organization,
9
+ set_as_default: set_as_default,
10
+ url: url,
11
+ product_name: product_name
12
+ }.reject { |_, value| value.nil? }
13
+
14
+ call_api(:post, __method__, params)
15
+ end
16
+
17
+ def edit(advertisable:, click_through_conversion_window: nil, name: nil, path_name: nil,
18
+ url: nil, product_name: nil, view_through_conversion_window: nil)
19
+
20
+ params = {
21
+ advertisable: advertisable,
22
+ click_through_conversion_window: click_through_conversion_window,
23
+ name: name,
24
+ path_name: path_name,
25
+ url: url,
26
+ product_name: product_name,
27
+ view_through_conversion_window: view_through_conversion_window
28
+ }.reject { |_, value| value.nil? }
29
+
30
+ call_api(:put, __method__, params)
31
+ end
32
+
33
+ def enable_rollcrawl(advertisable:, url:)
34
+ params = {
35
+ advertisable: advertisable,
36
+ url: url
37
+ }
38
+
39
+ call_api(:get, __method__, params)
40
+ end
41
+
42
+ def get(advertisable:)
43
+ params = {
44
+ advertisable: advertisable
45
+ }
46
+
47
+ call_api(:get, __method__, params)
48
+ end
49
+
50
+ def get_adgroups(advertisable:, camp_active: true, camp_statuses: nil, camp_blacklist_statuses: nil,
51
+ camp_type: nil, statuses: %w(approved admin_review paused admin_paused),
52
+ blacklist_statuses: nil)
53
+
54
+ params = {
55
+ advertisable: advertisable,
56
+ camp_active: camp_active,
57
+ camp_statuses: camp_statuses,
58
+ camp_blacklist_statuses: camp_blacklist_statuses,
59
+ camp_type: camp_type,
60
+ statuses: statuses,
61
+ blacklist_statuses: blacklist_statuses
62
+ }.reject { |_, value| value.nil? }
63
+
64
+ call_api(:get, __method__, params)
65
+ end
66
+
67
+ def get_ads(advertisable:, is_active: true, statuses: nil, types: nil, width: nil, height: nil)
68
+ params = {
69
+ advertisable: advertisable,
70
+ is_active: is_active,
71
+ statuses: statuses,
72
+ types: types,
73
+ width: width,
74
+ height: height
75
+ }.reject { |_, value| value.nil? }
76
+
77
+ call_api(:get, __method__, params)
78
+ end
79
+
80
+ def get_campaigns(advertisable:, is_active: true, statuses: nil, types: nil, blacklist_statuses: nil)
81
+ params = {
82
+ advertisable: advertisable,
83
+ is_active: is_active,
84
+ statuses: statuses,
85
+ blacklist_statues: blacklist_statuses,
86
+ types: types
87
+ }.reject { |_, value| value.nil? }
88
+
89
+ call_api(:get, __method__, params)
90
+ end
91
+
92
+ def get_coops(advertisable:, filter_active:, coops_active: true)
93
+ params = {
94
+ advertisable: advertisable,
95
+ filter_active: filter_active,
96
+ coops_active: coops_active
97
+ }.reject { |_, value| value.nil? }
98
+
99
+ call_api(:get, __method__, params)
100
+ end
101
+
102
+ def get_pixel(advertisable:)
103
+ params = {
104
+ advertisable: advertisable
105
+ }
106
+
107
+ call_api(:get, __method__, params)
108
+ end
109
+
110
+ def get_segments(advertisable:)
111
+ params = {
112
+ advertisable: advertisable
113
+ }
114
+
115
+ call_api(:get, __method__, params)
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end