Class: Adzerk::Flight

Inherits:
ApiEndpoint show all
Defined in:
lib/adzerk/flight.rb

Instance Attribute Summary

Attributes inherited from ApiEndpoint

#client, #datakey, #endpoint, #subendpoint

Instance Method Summary collapse

Methods inherited from ApiEndpoint

#create, #delete, #get, #initialize, #list, #update

Methods included from Util

#camelize_data, #parse_response, #uncamelize_data

Constructor Details

This class inherits a constructor from Adzerk::ApiEndpoint

Instance Method Details

#countriesObject



3
4
5
6
# File 'lib/adzerk/flight.rb', line 3

def countries
  response = @client.get_request('countries')
  parse_response(response)
end

#filter_flights(data = {}) ⇒ Object



42
43
44
45
46
# File 'lib/adzerk/flight.rb', line 42

def filter_flights(data={})
  query_string = URI.encode_www_form(data)
  url = "fast/flight?#{query_string}"
  @client.filter(url)
end

#instant_counts(flight_id, data = {}) ⇒ Object



20
21
22
23
24
# File 'lib/adzerk/flight.rb', line 20

def instant_counts(flight_id, data={})
  query_string = URI.encode_www_form(data)
  url = "instantcounts/#{endpoint}/#{flight_id}?#{query_string}"
  parse_response(client.get_request(url))
end

#list_for_advertiser(advertiser_id, is_active = nil) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/adzerk/flight.rb', line 34

def list_for_advertiser(advertiser_id, is_active = nil)
  url = "advertiser/#{advertiser_id}/flight"
  if !is_active.nil?
    url = "#{url}?isActive=#{is_active}"
  end
  parse_response(@client.get_request(url))
end

#list_for_campaign(campaign_id, is_active = nil) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/adzerk/flight.rb', line 26

def list_for_campaign(campaign_id, is_active = nil)
  url = "campaign/#{campaign_id}/flight"
  if !is_active.nil?
    url = "#{url}?isActive=#{is_active}"
  end
  parse_response(@client.get_request(url))
end

#list_regions_for_country(country_code) ⇒ Object



14
15
16
17
18
# File 'lib/adzerk/flight.rb', line 14

def list_regions_for_country(country_code)
  url = "country/#{country_code}/regions?version=2"
  response = @client.get_request(url)
  parse_response(response)
end

#regions(region) ⇒ Object



8
9
10
11
12
# File 'lib/adzerk/flight.rb', line 8

def regions(region)
  url = "region/#{region}"
  response = @client.get_request(url)
  parse_response(response)
end