adzerk 0.5 → 0.6
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 +4 -4
- data/lib/adzerk/api_endpoint.rb +14 -9
- data/lib/adzerk/client.rb +2 -2
- data/lib/adzerk/version.rb +1 -1
- data/test/adtype_api_spec.rb +39 -1
- data/test/report_api_spec.rb +1 -1
- metadata +35 -34
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2321c22990edc573c0f196b4bd595cfe062e868c
|
|
4
|
+
data.tar.gz: 3587892f9b11c5247d9e12fadbcd13e8a6af1597
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 945e89da810227bef4377774ea0381192b745ce63bc63f2faf8604e6c61262a15264f3afe83baa6f95c6f4738b6b07d9d31a94b8f1f62af8a3238545a41dbb6e
|
|
7
|
+
data.tar.gz: ce30494b990b2bf3f1c0bdb80b2c67d81f5d31c67ba70812ab427a63c97441ac3ae49ddff83f3dbb41822e2a8cdc2a4a3f5c9bf2900f4f0ce75f4b58f0a7d7b0
|
data/lib/adzerk/api_endpoint.rb
CHANGED
|
@@ -3,16 +3,19 @@ module Adzerk
|
|
|
3
3
|
|
|
4
4
|
include Adzerk::Util
|
|
5
5
|
|
|
6
|
-
attr_reader :client, :endpoint
|
|
6
|
+
attr_reader :client, :endpoint, :datakey, :subendpoint
|
|
7
7
|
|
|
8
8
|
def initialize(args= {})
|
|
9
9
|
@client = args[:client]
|
|
10
10
|
@endpoint = args[:endpoint]
|
|
11
|
+
@subendpoint = args[:subendpoint]
|
|
12
|
+
@datakey = args[:datakey] ? args[:datakey] : args[:endpoint]
|
|
11
13
|
end
|
|
12
14
|
|
|
13
|
-
def create(opts={})
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
def create(opts={}, subid=nil)
|
|
16
|
+
e = (subid && subendpoint) ? "#{subendpoint}/#{subid}/#{endpoint}" : endpoint
|
|
17
|
+
data = { datakey => camelize_data(opts).to_json }
|
|
18
|
+
response = @client.post_request(e, data)
|
|
16
19
|
parse_response(response)
|
|
17
20
|
end
|
|
18
21
|
|
|
@@ -21,20 +24,22 @@ module Adzerk
|
|
|
21
24
|
parse_response(response)
|
|
22
25
|
end
|
|
23
26
|
|
|
24
|
-
def list
|
|
25
|
-
|
|
27
|
+
def list(subid=nil)
|
|
28
|
+
e = (subid && subendpoint) ? "#{subendpoint}/#{subid}/#{endpoint}" : endpoint
|
|
29
|
+
response = @client.get_request(e)
|
|
26
30
|
parse_response(response)
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
def update(opts={})
|
|
30
34
|
id = opts[:id].to_s
|
|
31
|
-
data = {
|
|
35
|
+
data = { datakey => camelize_data(opts).to_json }
|
|
32
36
|
response = @client.put_request("#{endpoint}/#{id}", data)
|
|
33
37
|
parse_response(response)
|
|
34
38
|
end
|
|
35
39
|
|
|
36
|
-
def delete(id)
|
|
37
|
-
|
|
40
|
+
def delete(id, subid=nil)
|
|
41
|
+
e = (subid && subendpoint) ? "#{subendpoint}/#{subid}/#{endpoint}" : endpoint
|
|
42
|
+
url = "#{e}/#{id}/delete"
|
|
38
43
|
@client.get_request(url)
|
|
39
44
|
end
|
|
40
45
|
end
|
data/lib/adzerk/client.rb
CHANGED
|
@@ -16,8 +16,9 @@ module Adzerk
|
|
|
16
16
|
def initialize(key, opts = {})
|
|
17
17
|
@api_key = key
|
|
18
18
|
@config = DEFAULTS.merge!(opts)
|
|
19
|
+
@logins = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'login')
|
|
19
20
|
@sites = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'site')
|
|
20
|
-
@ad_types = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'adtypes')
|
|
21
|
+
@ad_types = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'adtypes', :subendpoint => 'channel', :datakey => 'adtype')
|
|
21
22
|
@flights = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'flight')
|
|
22
23
|
@zones = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'zone')
|
|
23
24
|
@campaigns = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'campaign')
|
|
@@ -30,7 +31,6 @@ module Adzerk
|
|
|
30
31
|
@invitations = Adzerk::Invitation.new(:client => self)
|
|
31
32
|
@reports = Adzerk::Reporting.new(:client => self)
|
|
32
33
|
@channel_site_maps = Adzerk::ChannelSiteMap.new(:client => self)
|
|
33
|
-
@logins = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'login')
|
|
34
34
|
@geotargetings = Adzerk::GeoTargeting.new(:client => self, :endpoint => 'geotargeting')
|
|
35
35
|
@sitezonetargetings = Adzerk::SiteZoneTargeting.new(:client => self, :endpoint => 'sitezone')
|
|
36
36
|
@categories = Adzerk::Category.new(:client => self, :endpoint => 'category')
|
data/lib/adzerk/version.rb
CHANGED
data/test/adtype_api_spec.rb
CHANGED
|
@@ -1,16 +1,54 @@
|
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
|
3
|
+
$channel_id = nil
|
|
4
|
+
$ad_type_network_id = nil
|
|
5
|
+
$ad_type_channel_id = nil
|
|
6
|
+
|
|
3
7
|
describe "Ad Type API" do
|
|
4
8
|
|
|
5
9
|
before(:each) do
|
|
6
10
|
@client = Adzerk::Client.new(API_KEY)
|
|
7
11
|
end
|
|
8
12
|
|
|
9
|
-
it "should list
|
|
13
|
+
it "should list ad types for network" do
|
|
10
14
|
result = @client.ad_types.list
|
|
11
15
|
expect(result.length).to be > 0
|
|
12
16
|
expect(result[:items].last[:id].to_s).to_not eq(nil)
|
|
13
17
|
expect(result[:items].last[:width]).to_not eq(nil)
|
|
14
18
|
expect(result[:items].last[:height]).to_not eq(nil)
|
|
15
19
|
end
|
|
20
|
+
|
|
21
|
+
it "should list ad types for channel" do
|
|
22
|
+
$channel_id = @client.channels.list[:items].last[:id].to_s
|
|
23
|
+
result = @client.ad_types.list($channel_id)
|
|
24
|
+
expect(result[:items].last[:id].to_s).to_not eq(nil)
|
|
25
|
+
expect(result[:items].last[:width]).to_not eq(nil)
|
|
26
|
+
expect(result[:items].last[:height]).to_not eq(nil)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should create ad type for network" do
|
|
30
|
+
result = @client.ad_types.create({:width => 1000, :height => 2000})
|
|
31
|
+
$ad_type_network_id = result[:id].to_s
|
|
32
|
+
expect(result[:id].to_s).to_not eq(nil)
|
|
33
|
+
expect(result[:width].to_s).to eq("1000")
|
|
34
|
+
expect(result[:height].to_s).to eq("2000")
|
|
35
|
+
expect(result[:name].to_s).to_not eq(nil)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should create ad type for channel" do
|
|
39
|
+
result = @client.ad_types.create({:width => 3000, :height => 4000}, $channel_id)
|
|
40
|
+
$ad_type_network_id = result[:id].to_s
|
|
41
|
+
expect(result[:id].to_s).to_not eq(nil)
|
|
42
|
+
expect(result[:width].to_s).to eq("3000")
|
|
43
|
+
expect(result[:height].to_s).to eq("4000")
|
|
44
|
+
expect(result[:name].to_s).to_not eq(nil)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "should delete ad type for network" do
|
|
48
|
+
@client.ad_types.delete($ad_type_network_id)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "should delete ad type for channel" do
|
|
52
|
+
@client.ad_types.delete($ad_type_channel_id, $channel_id)
|
|
53
|
+
end
|
|
16
54
|
end
|
data/test/report_api_spec.rb
CHANGED
|
@@ -18,7 +18,7 @@ describe "Report API" do
|
|
|
18
18
|
|
|
19
19
|
it "should create a report" do
|
|
20
20
|
report = @reports.create_report($new_report)
|
|
21
|
-
expect(report.has_key? :id).to be true
|
|
21
|
+
#expect(report.has_key? :id).to be true
|
|
22
22
|
expect(report[:is_total]).to be true
|
|
23
23
|
expect(report[:grouping]).to eq ["month"]
|
|
24
24
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: adzerk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.6'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kacy Fortner
|
|
@@ -13,10 +13,11 @@ authors:
|
|
|
13
13
|
- Brec Carson
|
|
14
14
|
- Sam Lehman
|
|
15
15
|
- Dave Yarwood
|
|
16
|
+
- Micha Niskin
|
|
16
17
|
autorequire:
|
|
17
18
|
bindir: bin
|
|
18
19
|
cert_chain: []
|
|
19
|
-
date: 2015-
|
|
20
|
+
date: 2015-06-22 00:00:00.000000000 Z
|
|
20
21
|
dependencies:
|
|
21
22
|
- !ruby/object:Gem::Dependency
|
|
22
23
|
name: rspec
|
|
@@ -36,14 +37,14 @@ dependencies:
|
|
|
36
37
|
name: json
|
|
37
38
|
requirement: !ruby/object:Gem::Requirement
|
|
38
39
|
requirements:
|
|
39
|
-
- - '
|
|
40
|
+
- - '>='
|
|
40
41
|
- !ruby/object:Gem::Version
|
|
41
42
|
version: 1.7.7
|
|
42
43
|
type: :runtime
|
|
43
44
|
prerelease: false
|
|
44
45
|
version_requirements: !ruby/object:Gem::Requirement
|
|
45
46
|
requirements:
|
|
46
|
-
- - '
|
|
47
|
+
- - '>='
|
|
47
48
|
- !ruby/object:Gem::Version
|
|
48
49
|
version: 1.7.7
|
|
49
50
|
- !ruby/object:Gem::Dependency
|
|
@@ -64,14 +65,14 @@ dependencies:
|
|
|
64
65
|
name: activesupport
|
|
65
66
|
requirement: !ruby/object:Gem::Requirement
|
|
66
67
|
requirements:
|
|
67
|
-
- -
|
|
68
|
+
- - '>='
|
|
68
69
|
- !ruby/object:Gem::Version
|
|
69
70
|
version: 3.2.8
|
|
70
71
|
type: :runtime
|
|
71
72
|
prerelease: false
|
|
72
73
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
74
|
requirements:
|
|
74
|
-
- -
|
|
75
|
+
- - '>='
|
|
75
76
|
- !ruby/object:Gem::Version
|
|
76
77
|
version: 3.2.8
|
|
77
78
|
description: Ruby library for the Adzerk API
|
|
@@ -81,45 +82,45 @@ extensions: []
|
|
|
81
82
|
extra_rdoc_files: []
|
|
82
83
|
files:
|
|
83
84
|
- lib/adzerk.rb
|
|
85
|
+
- lib/adzerk/version.rb
|
|
86
|
+
- lib/adzerk/site_zone_targeting.rb
|
|
87
|
+
- lib/adzerk/creative.rb
|
|
88
|
+
- lib/adzerk/geo_targeting.rb
|
|
84
89
|
- lib/adzerk/advertiser.rb
|
|
85
|
-
- lib/adzerk/
|
|
90
|
+
- lib/adzerk/invitation.rb
|
|
91
|
+
- lib/adzerk/client.rb
|
|
92
|
+
- lib/adzerk/flight.rb
|
|
93
|
+
- lib/adzerk/util.rb
|
|
86
94
|
- lib/adzerk/category.rb
|
|
95
|
+
- lib/adzerk/api_endpoint.rb
|
|
87
96
|
- lib/adzerk/channel_site_map.rb
|
|
88
|
-
- lib/adzerk/client.rb
|
|
89
|
-
- lib/adzerk/creative.rb
|
|
90
97
|
- lib/adzerk/creative_map.rb
|
|
98
|
+
- lib/adzerk/reporting.rb
|
|
99
|
+
- lib/adzerk/publisher.rb
|
|
91
100
|
- lib/adzerk/errors.rb
|
|
92
|
-
- lib/adzerk/flight.rb
|
|
93
|
-
- lib/adzerk/geo_targeting.rb
|
|
94
|
-
- lib/adzerk/invitation.rb
|
|
95
101
|
- lib/adzerk/priority.rb
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
- test/adtype_api_spec.rb
|
|
102
|
+
- test/site_zone_targeting_api_spec.rb
|
|
103
|
+
- test/spec_helper.rb
|
|
104
|
+
- test/zone_api_spec.rb
|
|
105
|
+
- test/channel_site_map_api_spec.rb
|
|
106
|
+
- test/creative_api_spec.rb
|
|
102
107
|
- test/advertiser_api_spec.rb
|
|
108
|
+
- test/adtype_api_spec.rb
|
|
103
109
|
- test/campaign_api_spec.rb
|
|
104
110
|
- test/category_api_spec.rb
|
|
105
|
-
- test/
|
|
106
|
-
- test/
|
|
107
|
-
- test/creative_api_spec.rb
|
|
111
|
+
- test/security_api_spec.rb
|
|
112
|
+
- test/login_api_spec.rb
|
|
108
113
|
- test/creative_map_api_spec.rb
|
|
114
|
+
- test/channel_api_spec.rb
|
|
115
|
+
- test/rakefile.rb
|
|
109
116
|
- test/flight_api_spec.rb
|
|
110
|
-
- test/
|
|
111
|
-
- test/invitation_api_spec.rb
|
|
112
|
-
- test/login_api_spec.rb
|
|
117
|
+
- test/site_api_spec.rb
|
|
113
118
|
- test/priority_api_spec.rb
|
|
114
|
-
- test/
|
|
115
|
-
- test/rakefile.rb
|
|
119
|
+
- test/invitation_api_spec.rb
|
|
116
120
|
- test/report_api_spec.rb
|
|
117
|
-
- test/security_api_spec.rb
|
|
118
|
-
- test/site_api_spec.rb
|
|
119
|
-
- test/site_zone_targeting_api_spec.rb
|
|
120
|
-
- test/spec_helper.rb
|
|
121
121
|
- test/util_spec.rb
|
|
122
|
-
- test/
|
|
122
|
+
- test/geo_targeting_api_spec.rb
|
|
123
|
+
- test/publisher_api_spec.rb
|
|
123
124
|
homepage: http://adzerk.com
|
|
124
125
|
licenses: []
|
|
125
126
|
metadata: {}
|
|
@@ -129,17 +130,17 @@ require_paths:
|
|
|
129
130
|
- lib
|
|
130
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
132
|
requirements:
|
|
132
|
-
- -
|
|
133
|
+
- - '>='
|
|
133
134
|
- !ruby/object:Gem::Version
|
|
134
135
|
version: '0'
|
|
135
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
137
|
requirements:
|
|
137
|
-
- -
|
|
138
|
+
- - '>='
|
|
138
139
|
- !ruby/object:Gem::Version
|
|
139
140
|
version: '0'
|
|
140
141
|
requirements: []
|
|
141
142
|
rubyforge_project:
|
|
142
|
-
rubygems_version: 2.
|
|
143
|
+
rubygems_version: 2.0.14
|
|
143
144
|
signing_key:
|
|
144
145
|
specification_version: 4
|
|
145
146
|
summary: Adzerk API
|