Class: EmailDirect::Creative

Inherits:
Object
  • Object
show all
Defined in:
lib/emaildirect/creative.rb

Overview

Represents a creative and associated functionality

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(creative_id) ⇒ Creative

Returns a new instance of Creative.



22
23
24
# File 'lib/emaildirect/creative.rb', line 22

def initialize(creative_id)
  @creative_id = creative_id
end

Instance Attribute Details

#creative_idObject (readonly)

Returns the value of attribute creative_id.



20
21
22
# File 'lib/emaildirect/creative.rb', line 20

def creative_id
  @creative_id
end

Class Method Details

.all(options = {}) ⇒ Object



8
9
10
11
# File 'lib/emaildirect/creative.rb', line 8

def all(options = {})
  response = EmailDirect.get '/Creatives', :query => options
  Hashie::Mash.new(response)
end

.create(name, options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/emaildirect/creative.rb', line 13

def create(name, options = {})
  options.merge! :Name => name
  response = EmailDirect.post '/Creatives', :body => options.to_json
  Hashie::Mash.new(response)
end

Instance Method Details

#deleteObject



37
38
39
40
# File 'lib/emaildirect/creative.rb', line 37

def delete
  response = EmailDirect.delete uri_for, {}
  Hashie::Mash.new(response)
end

#detailsObject



26
27
28
29
# File 'lib/emaildirect/creative.rb', line 26

def details
  response = get
  Hashie::Mash.new(response)
end

#update(name, options) ⇒ Object



31
32
33
34
35
# File 'lib/emaildirect/creative.rb', line 31

def update(name, options)
  options.merge! :Name => name
  response = EmailDirect.put uri_for, :body => options.to_json
  Hashie::Mash.new(response)
end