Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/adzerk/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ def create_creative(data={}, image_path='')
response
end

def update_creative(data={}, image_path='')
response = RestClient.patch(@config[:host] + 'creative',
{:creative => camelize_data(data).to_json},
:X_Adzerk_ApiKey => @api_key,
:accept => :json)
response = upload_creative(JSON.parse(response)["Id"], image_path) unless image_path.empty?
response
end

def upload_creative(id, image_path, size_override: false)
image = File.new(image_path, 'rb')
url = @config[:host] + 'creative/' + id.to_s + '/upload'
Expand Down
5 changes: 5 additions & 0 deletions lib/adzerk/creative.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ def create(data= {}, imagepath='')
uncamelize_data(JSON.parse(response))
end

def update(data= {}, imagepath='')
response = @client.update_creative(data, imagepath)
uncamelize_data(JSON.parse(response))
end

def list(advertiserId)
url = 'advertiser/' + advertiserId.to_s + "/creatives"
parse_response(@client.get_request(url))
Expand Down