Class: Mailjet::Messageinformation

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/mailjet/resources/messageinformation.rb

Constant Summary

Constants included from Resource

Resource::DATA_URLS, Resource::NON_JSON_URLS, Resource::OPTIONS

Instance Attribute Summary

Attributes included from Resource

#attributes, #persisted

Class Method Summary collapse

Methods included from Resource

#delete, included, #initialize, #persisted?, #save, #save!, #update_attributes

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Mailjet::Resource

Class Method Details

.find(id, job_id = nil, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mailjet/resources/messageinformation.rb', line 11

def self.find(id, job_id = nil, options = {})
  opts = define_options(options)
  self.resource_path = create_action_resource_path(id, job_id) if self.action

  raw_data = parse_api_json(connection(opts)[id].get(default_headers).body)

  raw_data.map do |entity|
    instanciate_from_api(entity)
  end
rescue Mailjet::CommunicationError => e
  if e.code == 404
    nil
  else
    raise e
  end
end