Sha256: a1d62265db0c9af34ecfbdfef673f54a18733062dbdfd686c96de49427ce307b
Contents?: true
Size: 1.14 KB
Versions: 11
Compression:
Stored size: 1.14 KB
Contents
require 'emaildirect' require 'json' module EmailDirect # Represents a creative and associated functionality class Creative class << self def all(options = {}) response = EmailDirect.get '/Creatives', :query => options Hashie::Mash.new(response) end def create(name, options = {}) options.merge! :Name => name response = EmailDirect.post '/Creatives', :body => options.to_json Hashie::Mash.new(response) end end attr_reader :creative_id def initialize(creative_id) @creative_id = creative_id end def details response = get Hashie::Mash.new(response) end def update(name, options) options.merge! :Name => name response = EmailDirect.put uri_for, :body => options.to_json Hashie::Mash.new(response) end def delete response = EmailDirect.delete uri_for, {} Hashie::Mash.new(response) end private def get(action = nil) EmailDirect.get uri_for(action) end def uri_for(action = nil) action = "/#{action}" if action "/Creatives/#{creative_id}#{action}" end end end
Version data entries
11 entries across 11 versions & 1 rubygems