appnexusapi 0.1.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -4
  3. data/UPGRADING.md +10 -0
  4. data/appnexusapi.gemspec +2 -0
  5. data/env_example +1 -3
  6. data/lib/appnexusapi/advertiser_resource.rb +2 -0
  7. data/lib/appnexusapi/advertiser_service.rb +2 -0
  8. data/lib/appnexusapi/campaign_resource.rb +2 -0
  9. data/lib/appnexusapi/campaign_service.rb +2 -0
  10. data/lib/appnexusapi/connection.rb +19 -5
  11. data/lib/appnexusapi/content_category_service.rb +3 -1
  12. data/lib/appnexusapi/creative_service.rb +0 -10
  13. data/lib/appnexusapi/payment_rule_resource.rb +2 -0
  14. data/lib/appnexusapi/payment_rule_service.rb +2 -0
  15. data/lib/appnexusapi/placement_resource.rb +2 -0
  16. data/lib/appnexusapi/placement_service.rb +2 -0
  17. data/lib/appnexusapi/profile_resource.rb +2 -0
  18. data/lib/appnexusapi/profile_service.rb +2 -0
  19. data/lib/appnexusapi/publisher_resource.rb +2 -0
  20. data/lib/appnexusapi/publisher_service.rb +2 -0
  21. data/lib/appnexusapi/resource.rb +5 -4
  22. data/lib/appnexusapi/service.rb +16 -8
  23. data/lib/appnexusapi/site_resource.rb +2 -0
  24. data/lib/appnexusapi/site_service.rb +2 -0
  25. data/lib/appnexusapi/version.rb +1 -1
  26. data/spec/connection_spec.rb +13 -3
  27. data/spec/creative_service_spec.rb +33 -22
  28. data/spec/fixtures/vcr/advertiser_get.yml +108 -0
  29. data/spec/fixtures/vcr/campaign_life_cycle.yml +524 -0
  30. data/spec/fixtures/vcr/content_category_crud.yml +398 -0
  31. data/spec/fixtures/vcr/creative_service_create.yml +216 -0
  32. data/spec/fixtures/vcr/creative_service_delete.yml +354 -0
  33. data/spec/fixtures/vcr/creative_service_get.yml +214 -0
  34. data/spec/fixtures/vcr/creative_service_update.yml +266 -0
  35. data/spec/fixtures/vcr/domain_list_limits.yml +105 -0
  36. data/spec/fixtures/vcr/line_item_life_cycle.yml +521 -0
  37. data/spec/fixtures/vcr/member_get.yml +150 -0
  38. data/spec/fixtures/vcr/object_limit_info.yml +105 -0
  39. data/spec/fixtures/vcr/payment_rule_lifecycle.yml +346 -0
  40. data/spec/fixtures/vcr/placement_service_default_placement.yml +166 -0
  41. data/spec/fixtures/vcr/profile_life_cycle.yml +349 -0
  42. data/spec/fixtures/vcr/profile_limits.yml +105 -0
  43. data/spec/fixtures/vcr/publisher_crud.yml +282 -0
  44. data/spec/fixtures/vcr/site_lifecycle.yml +284 -0
  45. data/spec/fixtures/vcr/user_login.yml +107 -0
  46. data/spec/fixtures/vcr/user_update.yml +288 -0
  47. data/spec/integration/advertiser_spec.rb +11 -0
  48. data/spec/integration/campaign_spec.rb +38 -0
  49. data/spec/integration/content_category_spec.rb +22 -0
  50. data/spec/integration/line_item_spec.rb +27 -0
  51. data/spec/integration/member_spec.rb +9 -0
  52. data/spec/integration/payment_rule_spec.rb +33 -0
  53. data/spec/integration/placement_spec.rb +29 -0
  54. data/spec/integration/profile_spec.rb +29 -0
  55. data/spec/integration/publisher_spec.rb +20 -0
  56. data/spec/integration/site_spec.rb +32 -0
  57. data/spec/integration/user_spec.rb +42 -0
  58. data/spec/object_limit_service_spec.rb +14 -11
  59. data/spec/spec_helper.rb +52 -25
  60. data/spec/support/shared_contexts.rb +28 -0
  61. metadata +109 -3
@@ -0,0 +1,107 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-test.appnexus.com/auth
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"auth":{"username":"<APPNEXUS_USERNAME>","password":"<APPNEXUS_PASSWORD>"}}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.11.0
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Cache-Control:
24
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0;no-cache
25
+ Content-Length:
26
+ - '698'
27
+ Content-Type:
28
+ - application/json
29
+ Date:
30
+ - Wed, 08 Feb 2017 12:59:25 GMT
31
+ Expires:
32
+ - Thu, 19 Nov 1981 08:52:00 GMT
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - Apache
37
+ Set-Cookie:
38
+ - HBFAPI_SESSID=hbapi%3A171678%3A589b162e31b3a%3Anym2; Path=/
39
+ X-Route:
40
+ - "/auth"
41
+ X-Route-Time:
42
+ - '1384'
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"response":{"status":"OK","token":"hbapi:171678:589b162e31b3a:nym2","dbg_info":{"instance":"01.hbapi.test104169.nym2","slave_hit":false,"db":"master","parent_dbg_info":{"instance":"01.api.test104169.nym2","slave_hit":false,"db":"master","awesomesauce_cache_used":false,"count_cache_used":false,"uuid":"0d9e096f-4020-5334-82c8-5bad38b57e01","warnings":[],"time":793.72978210449,"start_microtime":1486558765.074,"version":"1.17","output_term":"not_found"},"awesomesauce_cache_used":false,"count_cache_used":false,"uuid":"d3d34a81-db7b-5457-8594-7b0ffcc53054","warnings":[],"time":1371.4709281921,"start_microtime":1486558765.0501,"version":"1.17.202","slave_lag":1040300,"output_term":"not_found"}}}'
46
+ http_version:
47
+ recorded_at: Wed, 08 Feb 2017 12:59:24 GMT
48
+ - request:
49
+ method: get
50
+ uri: https://api-test.appnexus.com/user?current=1&num_elements=100&start_element=0
51
+ body:
52
+ encoding: US-ASCII
53
+ string: ''
54
+ headers:
55
+ User-Agent:
56
+ - Faraday v0.11.0
57
+ Authorization:
58
+ - hbapi:171678:589b162e31b3a:nym2
59
+ Accept-Encoding:
60
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
61
+ Accept:
62
+ - "*/*"
63
+ response:
64
+ status:
65
+ code: 200
66
+ message: OK
67
+ headers:
68
+ Cache-Control:
69
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0;no-cache
70
+ Content-Length:
71
+ - '1396'
72
+ Content-Type:
73
+ - application/json
74
+ Date:
75
+ - Wed, 08 Feb 2017 12:59:26 GMT
76
+ Expires:
77
+ - Thu, 19 Nov 1981 08:52:00 GMT
78
+ Pragma:
79
+ - no-cache
80
+ Server:
81
+ - Apache
82
+ Set-Cookie:
83
+ - HBFAPI_SESSID=hbapi%3A171678%3A589b162e31b3a%3Anym2; Path=/
84
+ X-Count-Read:
85
+ - user:7,member:2,serviceHostUser:1,serviceHostMember:1,hostUser:2,hostMember:2,ip:0
86
+ X-Count-Write:
87
+ - user:4,member:4,serviceHostUser:0,serviceHostMember:0,hostUser:4,hostMember:4,ip:0
88
+ X-Ratelimit-Read:
89
+ - '1000'
90
+ X-Ratelimit-Service:
91
+ - 1000-Default
92
+ X-Ratelimit-System:
93
+ - 1000-Default
94
+ X-Ratelimit-Write:
95
+ - '1000'
96
+ X-Route:
97
+ - "/user"
98
+ X-Route-Time:
99
+ - '28'
100
+ body:
101
+ encoding: UTF-8
102
+ string: '{"response":{"status":"OK","start_element":0,"num_elements":100,"user":{"id":171678,"first_name":"Analytics","last_name":"Dev","phone":"","username":"<APPNEXUS_USERNAME>","email":"<APPNEXUS_USERNAME>","user_type":"member","read_only":false,"api_login":true,"entity_id":487,"publisher_id":null,"advertiser_id":null,"custom_data":"{}","send_safety_budget_notifications":false,"entity_name":"Lumos
103
+ Labs","timezone":"EST5EDT","entity_reporting_decimal_type":"decimal","reporting_decimal_type":"decimal","decimal_mark":"period","thousand_separator":"comma","is_admin":false,"last_modified":"2017-02-08
104
+ 11:51:42","is_developer":false,"role_id":null,"state":"active","password_expires_on":null,"advertiser_access":null,"publisher_access":null},"count":1,"dbg_info":{"instance":"01.hbapi.test104169.nym2","slave_hit":false,"db":"master","user::reads":7,"user::read_limit":1000,"user::read_limit_seconds":60,"user::writes":4,"user::write_limit":1000,"user::write_limit_seconds":60,"reads":2,"read_limit":1000,"read_limit_seconds":60,"writes":4,"write_limit":1000,"write_limit_seconds":60,"awesomesauce_cache_used":false,"count_cache_used":false,"uuid":"0818d126-ebc4-500c-8f86-0bdc8d5e2d53","warnings":[],"time":18.574953079224,"start_microtime":1486558766.8049,"version":"1.17.202","slave_miss":"no_slaves_found","slave_lag":1040309,"member_last_modified_age":1249,"output_term":"user"}}}'
105
+ http_version:
106
+ recorded_at: Wed, 08 Feb 2017 12:59:24 GMT
107
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,288 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-test.appnexus.com/auth
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"auth":{"username":"<APPNEXUS_USERNAME>","password":"<APPNEXUS_PASSWORD>"}}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.11.0
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Cache-Control:
24
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0;no-cache
25
+ Content-Length:
26
+ - '699'
27
+ Content-Type:
28
+ - application/json
29
+ Date:
30
+ - Wed, 08 Feb 2017 12:59:27 GMT
31
+ Expires:
32
+ - Thu, 19 Nov 1981 08:52:00 GMT
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - Apache
37
+ Set-Cookie:
38
+ - HBFAPI_SESSID=hbapi%3A171678%3A589b163056ac9%3Anym2; Path=/
39
+ X-Route:
40
+ - "/auth"
41
+ X-Route-Time:
42
+ - '1383'
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"response":{"status":"OK","token":"hbapi:171678:589b163056ac9:nym2","dbg_info":{"instance":"01.hbapi.test104169.nym2","slave_hit":false,"db":"master","parent_dbg_info":{"instance":"01.api.test104169.nym2","slave_hit":false,"db":"master","awesomesauce_cache_used":false,"count_cache_used":false,"uuid":"43400c7f-a6f2-5028-b567-8f0d0727e053","warnings":[],"time":801.22804641724,"start_microtime":1486558767.2259,"version":"1.17","output_term":"not_found"},"awesomesauce_cache_used":false,"count_cache_used":false,"uuid":"a91383cd-2622-52ea-9ced-856c9f629eff","warnings":[],"time":1371.9110488892,"start_microtime":1486558767.2019,"version":"1.17.202","slave_lag":1040309,"output_term":"not_found"}}}'
46
+ http_version:
47
+ recorded_at: Wed, 08 Feb 2017 12:59:26 GMT
48
+ - request:
49
+ method: get
50
+ uri: https://api-test.appnexus.com/user?current=1&num_elements=100&start_element=0
51
+ body:
52
+ encoding: US-ASCII
53
+ string: ''
54
+ headers:
55
+ User-Agent:
56
+ - Faraday v0.11.0
57
+ Authorization:
58
+ - hbapi:171678:589b163056ac9:nym2
59
+ Accept-Encoding:
60
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
61
+ Accept:
62
+ - "*/*"
63
+ response:
64
+ status:
65
+ code: 200
66
+ message: OK
67
+ headers:
68
+ Cache-Control:
69
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0;no-cache
70
+ Content-Length:
71
+ - '1395'
72
+ Content-Type:
73
+ - application/json
74
+ Date:
75
+ - Wed, 08 Feb 2017 12:59:28 GMT
76
+ Expires:
77
+ - Thu, 19 Nov 1981 08:52:00 GMT
78
+ Pragma:
79
+ - no-cache
80
+ Server:
81
+ - Apache
82
+ Set-Cookie:
83
+ - HBFAPI_SESSID=hbapi%3A171678%3A589b163056ac9%3Anym2; Path=/
84
+ X-Count-Read:
85
+ - user:9,member:3,serviceHostUser:2,serviceHostMember:2,hostUser:3,hostMember:3,ip:0
86
+ X-Count-Write:
87
+ - user:4,member:4,serviceHostUser:0,serviceHostMember:0,hostUser:4,hostMember:4,ip:0
88
+ X-Ratelimit-Read:
89
+ - '1000'
90
+ X-Ratelimit-Service:
91
+ - 1000-Default
92
+ X-Ratelimit-System:
93
+ - 1000-Default
94
+ X-Ratelimit-Write:
95
+ - '1000'
96
+ X-Route:
97
+ - "/user"
98
+ X-Route-Time:
99
+ - '27'
100
+ body:
101
+ encoding: UTF-8
102
+ string: '{"response":{"status":"OK","start_element":0,"num_elements":100,"user":{"id":171678,"first_name":"Analytics","last_name":"Dev","phone":"","username":"<APPNEXUS_USERNAME>","email":"<APPNEXUS_USERNAME>","user_type":"member","read_only":false,"api_login":true,"entity_id":487,"publisher_id":null,"advertiser_id":null,"custom_data":"{}","send_safety_budget_notifications":false,"entity_name":"Lumos
103
+ Labs","timezone":"EST5EDT","entity_reporting_decimal_type":"decimal","reporting_decimal_type":"decimal","decimal_mark":"period","thousand_separator":"comma","is_admin":false,"last_modified":"2017-02-08
104
+ 11:51:42","is_developer":false,"role_id":null,"state":"active","password_expires_on":null,"advertiser_access":null,"publisher_access":null},"count":1,"dbg_info":{"instance":"01.hbapi.test104169.nym2","slave_hit":false,"db":"master","user::reads":9,"user::read_limit":1000,"user::read_limit_seconds":60,"user::writes":4,"user::write_limit":1000,"user::write_limit_seconds":60,"reads":3,"read_limit":1000,"read_limit_seconds":60,"writes":4,"write_limit":1000,"write_limit_seconds":60,"awesomesauce_cache_used":false,"count_cache_used":true,"uuid":"d8b8c8ea-ea9d-5539-a876-e94dc93f95f5","warnings":[],"time":17.499923706055,"start_microtime":1486558769.0024,"version":"1.17.202","slave_miss":"no_slaves_found","slave_lag":1040309,"member_last_modified_age":1252,"output_term":"user"}}}'
105
+ http_version:
106
+ recorded_at: Wed, 08 Feb 2017 12:59:27 GMT
107
+ - request:
108
+ method: put
109
+ uri: https://api-test.appnexus.com/user?id=171678
110
+ body:
111
+ encoding: UTF-8
112
+ string: '{"user":{"last_name":"test"}}'
113
+ headers:
114
+ User-Agent:
115
+ - Faraday v0.11.0
116
+ Authorization:
117
+ - hbapi:171678:589b163056ac9:nym2
118
+ Content-Type:
119
+ - application/json
120
+ Accept-Encoding:
121
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
122
+ Accept:
123
+ - "*/*"
124
+ response:
125
+ status:
126
+ code: 200
127
+ message: OK
128
+ headers:
129
+ Cache-Control:
130
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0;no-cache
131
+ Content-Length:
132
+ - '1386'
133
+ Content-Type:
134
+ - application/json
135
+ Date:
136
+ - Wed, 08 Feb 2017 12:59:29 GMT
137
+ Expires:
138
+ - Thu, 19 Nov 1981 08:52:00 GMT
139
+ Pragma:
140
+ - no-cache
141
+ Server:
142
+ - Apache
143
+ Set-Cookie:
144
+ - HBFAPI_SESSID=hbapi%3A171678%3A589b163056ac9%3Anym2; Path=/
145
+ X-Count-Read:
146
+ - user:9,member:3,serviceHostUser:2,serviceHostMember:2,hostUser:3,hostMember:3,ip:0
147
+ X-Count-Write:
148
+ - user:5,member:5,serviceHostUser:1,serviceHostMember:1,hostUser:5,hostMember:5,ip:0
149
+ X-Ratelimit-Read:
150
+ - '1000'
151
+ X-Ratelimit-Service:
152
+ - 1000-Default
153
+ X-Ratelimit-System:
154
+ - 1000-Default
155
+ X-Ratelimit-Write:
156
+ - '1000'
157
+ X-Route:
158
+ - "/user"
159
+ X-Route-Time:
160
+ - '99'
161
+ body:
162
+ encoding: UTF-8
163
+ string: '{"response":{"status":"OK","count":1,"id":"171678","start_element":0,"num_elements":100,"user":{"id":171678,"first_name":"Analytics","last_name":"test","phone":"","username":"<APPNEXUS_USERNAME>","email":"<APPNEXUS_USERNAME>","user_type":"member","read_only":false,"api_login":true,"entity_id":487,"publisher_id":null,"advertiser_id":null,"custom_data":"{}","send_safety_budget_notifications":false,"entity_name":"Lumos
164
+ Labs","timezone":"EST5EDT","entity_reporting_decimal_type":"decimal","reporting_decimal_type":"decimal","decimal_mark":"period","thousand_separator":"comma","is_admin":false,"last_modified":"2017-02-08
165
+ 12:59:29","is_developer":false,"role_id":null,"state":"active","password_expires_on":null,"advertiser_access":null,"publisher_access":null},"dbg_info":{"instance":"01.hbapi.test104169.nym2","slave_hit":false,"db":"master","user::reads":9,"user::read_limit":1000,"user::read_limit_seconds":60,"user::writes":5,"user::write_limit":1000,"user::write_limit_seconds":60,"reads":3,"read_limit":1000,"read_limit_seconds":60,"writes":5,"write_limit":1000,"write_limit_seconds":60,"awesomesauce_cache_used":false,"count_cache_used":false,"uuid":"324739a4-3b68-51dd-8b4f-d428a041755b","warnings":[],"time":85.218906402588,"start_microtime":1486558769.4822,"version":"1.17.202","slave_lag":1040309,"member_last_modified_age":1486558769,"output_term":"user"}}}'
166
+ http_version:
167
+ recorded_at: Wed, 08 Feb 2017 12:59:27 GMT
168
+ - request:
169
+ method: get
170
+ uri: https://api-test.appnexus.com/user?id=171678&num_elements=100&start_element=0
171
+ body:
172
+ encoding: US-ASCII
173
+ string: ''
174
+ headers:
175
+ User-Agent:
176
+ - Faraday v0.11.0
177
+ Authorization:
178
+ - hbapi:171678:589b163056ac9:nym2
179
+ Accept-Encoding:
180
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
181
+ Accept:
182
+ - "*/*"
183
+ response:
184
+ status:
185
+ code: 200
186
+ message: OK
187
+ headers:
188
+ Cache-Control:
189
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0;no-cache
190
+ Content-Length:
191
+ - '1395'
192
+ Content-Type:
193
+ - application/json
194
+ Date:
195
+ - Wed, 08 Feb 2017 12:59:30 GMT
196
+ Expires:
197
+ - Thu, 19 Nov 1981 08:52:00 GMT
198
+ Pragma:
199
+ - no-cache
200
+ Server:
201
+ - Apache
202
+ Set-Cookie:
203
+ - HBFAPI_SESSID=hbapi%3A171678%3A589b163056ac9%3Anym2; Path=/
204
+ X-Count-Read:
205
+ - user:10,member:4,serviceHostUser:3,serviceHostMember:3,hostUser:4,hostMember:4,ip:0
206
+ X-Count-Write:
207
+ - user:5,member:5,serviceHostUser:1,serviceHostMember:1,hostUser:5,hostMember:5,ip:0
208
+ X-Ratelimit-Read:
209
+ - '1000'
210
+ X-Ratelimit-Service:
211
+ - 1000-Default
212
+ X-Ratelimit-System:
213
+ - 1000-Default
214
+ X-Ratelimit-Write:
215
+ - '1000'
216
+ X-Route:
217
+ - "/user"
218
+ X-Route-Time:
219
+ - '234'
220
+ body:
221
+ encoding: UTF-8
222
+ string: '{"response":{"status":"OK","start_element":0,"num_elements":100,"user":{"id":171678,"first_name":"Analytics","last_name":"test","phone":"","username":"<APPNEXUS_USERNAME>","email":"<APPNEXUS_USERNAME>","user_type":"member","read_only":false,"api_login":true,"entity_id":487,"publisher_id":null,"advertiser_id":null,"custom_data":"{}","send_safety_budget_notifications":false,"entity_name":"Lumos
223
+ Labs","timezone":"EST5EDT","entity_reporting_decimal_type":"decimal","reporting_decimal_type":"decimal","decimal_mark":"period","thousand_separator":"comma","is_admin":false,"last_modified":"2017-02-08
224
+ 12:59:29","is_developer":false,"role_id":null,"state":"active","password_expires_on":null,"advertiser_access":null,"publisher_access":null},"count":1,"dbg_info":{"instance":"01.hbapi.test104169.nym2","slave_hit":false,"db":"master","user::reads":10,"user::read_limit":1000,"user::read_limit_seconds":60,"user::writes":5,"user::write_limit":1000,"user::write_limit_seconds":60,"reads":4,"read_limit":1000,"read_limit_seconds":60,"writes":5,"write_limit":1000,"write_limit_seconds":60,"awesomesauce_cache_used":false,"count_cache_used":false,"uuid":"e753df42-3cb3-5ccb-8475-39be94d5e9bd","warnings":[],"time":223.97899627686,"start_microtime":1486558770.0428,"version":"1.17.202","slave_miss":"no_slaves_found","slave_lag":1040309,"member_last_modified_age":1,"output_term":"user"}}}'
225
+ http_version:
226
+ recorded_at: Wed, 08 Feb 2017 12:59:28 GMT
227
+ - request:
228
+ method: put
229
+ uri: https://api-test.appnexus.com/user?id=171678
230
+ body:
231
+ encoding: UTF-8
232
+ string: '{"user":{"last_name":"Dev"}}'
233
+ headers:
234
+ User-Agent:
235
+ - Faraday v0.11.0
236
+ Authorization:
237
+ - hbapi:171678:589b163056ac9:nym2
238
+ Content-Type:
239
+ - application/json
240
+ Accept-Encoding:
241
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
242
+ Accept:
243
+ - "*/*"
244
+ response:
245
+ status:
246
+ code: 200
247
+ message: OK
248
+ headers:
249
+ Cache-Control:
250
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0;no-cache
251
+ Content-Length:
252
+ - '1386'
253
+ Content-Type:
254
+ - application/json
255
+ Date:
256
+ - Wed, 08 Feb 2017 12:59:30 GMT
257
+ Expires:
258
+ - Thu, 19 Nov 1981 08:52:00 GMT
259
+ Pragma:
260
+ - no-cache
261
+ Server:
262
+ - Apache
263
+ Set-Cookie:
264
+ - HBFAPI_SESSID=hbapi%3A171678%3A589b163056ac9%3Anym2; Path=/
265
+ X-Count-Read:
266
+ - user:10,member:4,serviceHostUser:3,serviceHostMember:3,hostUser:4,hostMember:4,ip:0
267
+ X-Count-Write:
268
+ - user:6,member:6,serviceHostUser:2,serviceHostMember:2,hostUser:6,hostMember:6,ip:0
269
+ X-Ratelimit-Read:
270
+ - '1000'
271
+ X-Ratelimit-Service:
272
+ - 1000-Default
273
+ X-Ratelimit-System:
274
+ - 1000-Default
275
+ X-Ratelimit-Write:
276
+ - '1000'
277
+ X-Route:
278
+ - "/user"
279
+ X-Route-Time:
280
+ - '271'
281
+ body:
282
+ encoding: UTF-8
283
+ string: '{"response":{"status":"OK","count":1,"id":"171678","start_element":0,"num_elements":100,"user":{"id":171678,"first_name":"Analytics","last_name":"Dev","phone":"","username":"<APPNEXUS_USERNAME>","email":"<APPNEXUS_USERNAME>","user_type":"member","read_only":false,"api_login":true,"entity_id":487,"publisher_id":null,"advertiser_id":null,"custom_data":"{}","send_safety_budget_notifications":false,"entity_name":"Lumos
284
+ Labs","timezone":"EST5EDT","entity_reporting_decimal_type":"decimal","reporting_decimal_type":"decimal","decimal_mark":"period","thousand_separator":"comma","is_admin":false,"last_modified":"2017-02-08
285
+ 12:59:30","is_developer":false,"role_id":null,"state":"active","password_expires_on":null,"advertiser_access":null,"publisher_access":null},"dbg_info":{"instance":"01.hbapi.test104169.nym2","slave_hit":false,"db":"master","user::reads":10,"user::read_limit":1000,"user::read_limit_seconds":60,"user::writes":6,"user::write_limit":1000,"user::write_limit_seconds":60,"reads":4,"read_limit":1000,"read_limit_seconds":60,"writes":6,"write_limit":1000,"write_limit_seconds":60,"awesomesauce_cache_used":false,"count_cache_used":false,"uuid":"35b5b341-540b-5da6-813d-e0261b1ff06c","warnings":[],"time":256.20198249817,"start_microtime":1486558770.7333,"version":"1.17.202","slave_lag":1040309,"member_last_modified_age":1486558770,"output_term":"user"}}}'
286
+ http_version:
287
+ recorded_at: Wed, 08 Feb 2017 12:59:29 GMT
288
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe AppnexusApi::AdvertiserService do
4
+ let(:advertiser_service) { described_class.new(connection) }
5
+
6
+ it 'supports a get operation' do
7
+ VCR.use_cassette('advertiser_get') do
8
+ expect { advertiser_service.get(num_elements: 1) }.to_not raise_error
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe AppnexusApi::CampaignService do
4
+ include_context 'with a new line item'
5
+
6
+ let(:campaign_name) { 'campaign name' }
7
+ let(:profile_params) do
8
+ {
9
+ code: 'spec_profile_code',
10
+ description: 'Targeting only the US',
11
+ country_targets: [ { id: 233 } ],
12
+ country_action: 'include'
13
+ }
14
+ end
15
+
16
+ it 'executes a campaigns life cycle' do
17
+ VCR.use_cassette('campaign_life_cycle') do
18
+ profile = AppnexusApi::ProfileService.new(connection).create(advertiser_url_params, profile_params)
19
+ new_line_item = AppnexusApi::LineItemService.new(connection).create(advertiser_url_params, line_item_params)
20
+ campaign_params = {
21
+ name: campaign_name,
22
+ code: 'codecode',
23
+ line_item_id: new_line_item.id,
24
+ inventory_type: 'direct',
25
+ profile_id: profile.id # profile is what targets Geo
26
+ }
27
+ campaign = described_class.new(connection).create(advertiser_url_params, campaign_params)
28
+
29
+ expect(campaign.name).to eq('campaign name')
30
+ expect(campaign.profile_id).to eq(profile.id)
31
+
32
+ campaign.delete(advertiser_url_params)
33
+ new_line_item.delete('advertiser_id' => advertiser_id)
34
+ profile.delete(advertiser_url_params)
35
+ advertiser.delete
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe AppnexusApi::ContentCategoryService do
4
+ let(:ccs) { described_class.new(connection) }
5
+ let(:name) { 'rspec_content_category' }
6
+ let(:name_update) { name + '_part_2' }
7
+
8
+ it 'cruds' do
9
+ VCR.use_cassette('content_category_crud') do
10
+ created = ccs.create({}, name: name)
11
+
12
+ gotten = ccs.get(id: created.id).first
13
+ expect(gotten.name).to eq(name)
14
+
15
+ gotten.update({}, name: name_update)
16
+ expect(ccs.get(id: created.id).first.name).to eq(name_update)
17
+
18
+ gotten.delete({})
19
+ expect(ccs.get(id: created.id)).to be_nil
20
+ end
21
+ end
22
+ end