Class: CreateSend::Transactional::SmartEmail

Inherits:
CreateSend
  • Object
show all
Defined in:
lib/createsend/transactional_smart_email.rb

Instance Attribute Summary collapse

Attributes inherited from CreateSend

#auth_details

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CreateSend

#add_auth_details_to_options, #administrators, #auth, authorize_url, #billing_details, #clients, #countries, #delete, exchange_token, #external_session_url, #get, #get_primary_contact, #handle_response, #post, #put, refresh_access_token, #refresh_token, #set_primary_contact, #systemdate, #timezones, user_agent

Constructor Details

#initialize(auth, smart_email_id) ⇒ SmartEmail

Returns a new instance of SmartEmail.



12
13
14
15
16
# File 'lib/createsend/transactional_smart_email.rb', line 12

def initialize(auth, smart_email_id)
  @auth = auth
  @smart_email_id = smart_email_id
  super
end

Instance Attribute Details

#smart_email_idObject (readonly)

Returns the value of attribute smart_email_id.



4
5
6
# File 'lib/createsend/transactional_smart_email.rb', line 4

def smart_email_id
  @smart_email_id
end

Class Method Details

.list(auth, options = nil) ⇒ Object



6
7
8
9
10
# File 'lib/createsend/transactional_smart_email.rb', line 6

def self.list(auth, options = nil)
  cs = CreateSend.new auth
  response = cs.get "/transactional/smartemail", :query => options
  response.map{|item| Hashie::Mash.new(item)}
end

Instance Method Details

#detailsObject



18
19
20
21
# File 'lib/createsend/transactional_smart_email.rb', line 18

def details
  response = get "/transactional/smartemail/#{@smart_email_id}"
  Hashie::Mash.new(response)
end

#send(options) ⇒ Object



23
24
25
26
# File 'lib/createsend/transactional_smart_email.rb', line 23

def send(options)
  response = post "/transactional/smartemail/#{@smart_email_id}/send", { :body => options.to_json }
  response.map{|item| Hashie::Mash.new(item)}
end