Class: Blastengine::Log

Inherits:
Base
  • Object
show all
Includes:
Blastengine
Defined in:
lib/blastengine/log.rb

Constant Summary

Constants included from Blastengine

BASE_PATH, DOMAIN, VERSION

Instance Attribute Summary collapse

Attributes inherited from Base

#created_time, #delivery_time, #delivery_type, #drop_count, #hard_error_count, #open_count, #sent_count, #soft_error_count, #status, #total_count, #updated_time

Class Method Summary collapse

Methods included from Blastengine

#email, initialize

Methods inherited from Base

#cancel, #client, client, #delete, #get, #set, #sets, #unsubscribe

Instance Attribute Details

#attachmentsObject

Returns the value of attribute attachments.



6
7
8
# File 'lib/blastengine/log.rb', line 6

def attachments
  @attachments
end

#bccObject

Returns the value of attribute bcc.



6
7
8
# File 'lib/blastengine/log.rb', line 6

def bcc
  @bcc
end

#ccObject

Returns the value of attribute cc.



6
7
8
# File 'lib/blastengine/log.rb', line 6

def cc
  @cc
end

#delivery_idObject

Returns the value of attribute delivery_id.



6
7
8
# File 'lib/blastengine/log.rb', line 6

def delivery_id
  @delivery_id
end

#encodeObject

Returns the value of attribute encode.



6
7
8
# File 'lib/blastengine/log.rb', line 6

def encode
  @encode
end

#html_partObject

Returns the value of attribute html_part.



6
7
8
# File 'lib/blastengine/log.rb', line 6

def html_part
  @html_part
end

#jobObject

Returns the value of attribute job.



6
7
8
# File 'lib/blastengine/log.rb', line 6

def job
  @job
end

#subjectObject

Returns the value of attribute subject.



6
7
8
# File 'lib/blastengine/log.rb', line 6

def subject
  @subject
end

#text_partObject

Returns the value of attribute text_part.



6
7
8
# File 'lib/blastengine/log.rb', line 6

def text_part
  @text_part
end

Class Method Details

.find(params = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/blastengine/log.rb', line 14

def self.find(params = {})
  Hash[ params.map{|k,v| [k.to_sym, v] } ]
  if params[:delivery_start] != nil
    params[:delivery_start] = params[:delivery_start].iso8601
  end
  if params[:delivery_end] != nil
    params[:delivery_end] = params[:delivery_end].iso8601
  end
  query_string = URI.encode_www_form(params)
  url = "/logs/mails/results?#{query_string}";
  res = Mail.client.get url
  return res['data'].map {|params| Log.from_hash params }
end

.from_hash(params) ⇒ Object



8
9
10
11
12
# File 'lib/blastengine/log.rb', line 8

def self.from_hash(params)
  log = Log.new
  log.sets(params)
  log
end