adzerk 0.22 → 0.23

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9d5721cc85181e76e5a21273fffc22da30e16f8581e1cc953ce14634c32ac62
4
- data.tar.gz: fd8dfb8cc373e9a7f3287c342c316b9b421574c5f53f026304b7366df57d3707
3
+ metadata.gz: 9fbe38f271c62aeecfa3bdc94249d5c419dc40efb125524f3fe1ae51db3e7b16
4
+ data.tar.gz: 39dbc95fdc5777c81292a528e214651651f577270591782a3b26d5803ae0b558
5
5
  SHA512:
6
- metadata.gz: 4ccd6060a84effc885176e2fe6d15af3194c38870b514b9ecc9e9f378c6e9e09ae6e6a827e306b504061334df6d1882511b3d786458068a00b39db511d9b1db3
7
- data.tar.gz: 4a02a699e8dce55be60dbf4ed6a1b2f15781dcb2c5c0db162ae73789a9b661aaa6ac3585546b00847103c134e28d7e5e817a6b41bb49c49d18cd2a83bc07571b
6
+ metadata.gz: f74a0c3de2a14807c41fdb03934a7bec98075ac2e5213e81bb51e8ed8d7568f85567e561fd4f57b1e5322960566af388293b8d82570476d1ebe08f1bbd34121b
7
+ data.tar.gz: 14155f269864e163f95dd0b14bf7e417f2c10efdec53fa14293370c7d1437d0e6717276dcc82ef071cf39384701ec31521bfe7f06dad7d9eb2797d91f03fdb04
data/lib/adzerk/client.rb CHANGED
@@ -27,7 +27,7 @@ module Adzerk
27
27
  @api_key = key
28
28
  @config = DEFAULTS.merge!(opts)
29
29
  @logins = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'login')
30
- @sites = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'site')
30
+ @sites = Adzerk::Site.new(:client => self, :endpoint => 'site')
31
31
  @ad_types = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'adtypes', :subendpoint => 'channel', :datakey => 'adtype')
32
32
  @flights = Adzerk::Flight.new(:client => self, :endpoint => 'flight')
33
33
  @zones = Adzerk::ApiEndpoint.new(:client => self, :endpoint => 'zone')
@@ -104,6 +104,33 @@ module Adzerk
104
104
  send_request(request, uri)
105
105
  end
106
106
 
107
+ def filter(url, version: 'v1')
108
+ uri = URI.parse("#{@config[:host]}#{version}/#{url}")
109
+ Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |https|
110
+ request = Net::HTTP::Get.new uri
111
+ request.add_field(@config[:header], @api_key)
112
+ request.add_field(SDK_HEADER_NAME, SDK_HEADER_VALUE)
113
+ https.request request do |response|
114
+ arr = []
115
+ response.read_body do |segment|
116
+ str = ''
117
+ str.concat(segment)
118
+ split_str = str.split("\n")
119
+ for line in split_str do
120
+ begin
121
+ obj = JSON.parse(line)
122
+ rescue => exception
123
+ str.concat(line)
124
+ else
125
+ arr.append(obj)
126
+ end
127
+ end
128
+ return arr
129
+ end
130
+ end
131
+ end
132
+ end
133
+
107
134
  def create_creative(data={}, image_path='', version: 'v1')
108
135
  response = nil
109
136
  attempt = 0
data/lib/adzerk/flight.rb CHANGED
@@ -30,5 +30,11 @@ module Adzerk
30
30
  end
31
31
  parse_response(@client.get_request(url))
32
32
  end
33
+
34
+ def filter_flights(data={})
35
+ query_string = URI.encode_www_form(data)
36
+ url = "fast/flight?#{query_string}"
37
+ @client.filter(url)
38
+ end
33
39
  end
34
40
  end
@@ -0,0 +1,9 @@
1
+ module Adzerk
2
+ class Site < ApiEndpoint
3
+ def filter_sites(data={})
4
+ query_string = URI.encode_www_form(data)
5
+ url = "fast/site?#{query_string}"
6
+ @client.filter(url)
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Adzerk
2
- VERSION = "0.22"
2
+ VERSION = "0.23"
3
3
  end
data/lib/adzerk.rb CHANGED
@@ -15,6 +15,7 @@ require "adzerk/reporting"
15
15
  require "adzerk/channel_site_map"
16
16
  require "adzerk/channel"
17
17
  require "adzerk/geo_targeting"
18
+ require "adzerk/site"
18
19
  require "adzerk/site_zone_targeting"
19
20
  require "adzerk/category"
20
21
  require "adzerk/client"
@@ -179,6 +179,15 @@ describe "Flight API" do
179
179
  expect(count.length).to be > 0
180
180
  end
181
181
 
182
+ it "should filter flights with a name that contains 'test' " do
183
+ data = {
184
+ isActive: true,
185
+ nameContains: "Test"
186
+ }
187
+ response = @flights.filter_flights(data)
188
+ expect(response).not_to eq(nil)
189
+ end
190
+
182
191
  it "should delete a new flight" do
183
192
  response = @flights.delete($flight_id)
184
193
  expect(response.body).to eq('"Successfully deleted"')
@@ -44,6 +44,15 @@ describe "Site API" do
44
44
  expect(result[:items].last[:publisher_account_id].to_s).to eq($site_pub_id)
45
45
  end
46
46
 
47
+ it "should filter sites" do
48
+ data = {
49
+ titleLike: "site",
50
+ urlLike: ".com"
51
+ }
52
+ response = @client.sites.filter_sites(data)
53
+ expect(response).not_to eq(nil)
54
+ end
55
+
47
56
  it "should delete a new site" do
48
57
  response = @client.sites.delete($site_id)
49
58
  expect(response.body).to eq('"Successfully deleted."')
@@ -55,5 +64,4 @@ describe "Site API" do
55
64
  expect(site[:id].to_s).not_to eq($site_id)
56
65
  end
57
66
  end
58
-
59
67
  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.22'
4
+ version: '0.23'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kacy Fortner
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
- date: 2021-12-08 00:00:00.000000000 Z
20
+ date: 2021-12-15 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rspec
@@ -117,6 +117,7 @@ files:
117
117
  - lib/adzerk/publisher.rb
118
118
  - lib/adzerk/reporting.rb
119
119
  - lib/adzerk/scheduled_reporting.rb
120
+ - lib/adzerk/site.rb
120
121
  - lib/adzerk/site_zone_targeting.rb
121
122
  - lib/adzerk/util.rb
122
123
  - lib/adzerk/version.rb