Class: Adzerk::CreativeTemplate

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/adzerk/creative_template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util

#camelize_data, #parse_response, #uncamelize_data

Constructor Details

#initialize(args = {}) ⇒ CreativeTemplate

Returns a new instance of CreativeTemplate.



8
9
10
# File 'lib/adzerk/creative_template.rb', line 8

def initialize(args={})
  @client = args[:client]
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/adzerk/creative_template.rb', line 6

def client
  @client
end

Instance Method Details

#create(data = {}) ⇒ Object



12
13
14
# File 'lib/adzerk/creative_template.rb', line 12

def create(data={})
  parse_response(@client.post_json_request("creative-templates", camelize_data(data), version: 'v2'))
end

#get(id) ⇒ Object



21
22
23
# File 'lib/adzerk/creative_template.rb', line 21

def get(id)
  parse_response(@client.get_request("creative-templates/#{id}", version: 'v2'))
end

#list(page: 1, pageSize: 100, includeArchived: false) ⇒ Object



25
26
27
28
# File 'lib/adzerk/creative_template.rb', line 25

def list(page: 1, pageSize: 100, includeArchived: false)
  url = "creative-templates?page=#{page}&pageSize=#{pageSize}&includeArchived=#{includeArchived}"
  parse_response(@client.get_request(url, version: 'v2'))
end

#update(id, data = {}) ⇒ Object



16
17
18
19
# File 'lib/adzerk/creative_template.rb', line 16

def update(id, data={})
  url = "creative-templates/#{id}/update"
  parse_response(@client.post_json_request(url, camelize_data(data), version: 'v2'))
end