mailjet 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7977d92ada648c6c8cf2df67727a59da6c758a4c
4
- data.tar.gz: 0d8355d074af5fcb2e047bef321ab0e9e0342ea2
3
+ metadata.gz: fc2b380d0a9752d1ee5a34808bfb357e50905ef2
4
+ data.tar.gz: 7ab37a7ffb8e5da6913ec46e8c28fe6f52083e7a
5
5
  SHA512:
6
- metadata.gz: d9f6e87fd943e5897261d2dcf37b3d057ebd098763699f1ed6ab74a598b29aecec0d2b374023e85be8004d5bcf0814e2a654252d375937c15bf1396ea9857331
7
- data.tar.gz: 52cb99ce66040b951f20d7e5a4c6660ec12d32b1095a619f3df4f4e0691e8f841bd1e2d907e84fbbab0df5e4f4ef52e221ed744b7f6d6ee7430ae305b71d43f8
6
+ metadata.gz: 8b243e215c9ff1ad03219b9179e3ae62d29d328e7e1744c8ad03906d197beae0d2369308a630e6eaf5f805b15e61b8b69028a64939e93e79125ab502195ba833
7
+ data.tar.gz: 388cf233e0d6e362f877d520107a998ff9c5f9e8cf091362da23bb46faab85ccd9ccefb2b9dc0b3d8eeb347867aa2baa27875a3cedc04b0980782a422bc6838c
@@ -71,6 +71,7 @@ module Mailjet
71
71
  self.resource_path = create_action_resource_path(id, job_id) if self.action
72
72
  #
73
73
  attributes = parse_api_json(connection[id].get(default_headers)).first
74
+ attributes[:id] = id
74
75
  instanciate_from_api(attributes)
75
76
  rescue Mailjet::ApiError => e
76
77
  if e.code == 404
@@ -83,6 +84,7 @@ module Mailjet
83
84
  def create(attributes = {})
84
85
  # if action method, ammend url to appropriate id
85
86
  self.resource_path = create_action_resource_path(attributes[:id]) if self.action
87
+
86
88
  self.new(attributes).tap do |resource|
87
89
  resource.save!
88
90
  resource.persisted = true
@@ -106,9 +108,12 @@ module Mailjet
106
108
  #Take the response from the API and put it through a method -- taken from the ActiveSupport library -- which converts
107
109
  #the date-time from "2014-05-19T15:31:09Z" to "Mon, 19 May 2014 15:31:09 +0000" format.
108
110
  response_hash = convert_dates_from(response_hash)
109
- #
110
- #
111
- response_data_array = response_hash['Data']
111
+
112
+ if response_hash['Data']
113
+ response_data_array = response_hash['Data']
114
+ else
115
+ response_data_array = response_hash
116
+ end
112
117
  response_data_array.map{ |response_data| underscore_keys(response_data) }
113
118
  end
114
119
 
@@ -157,7 +162,7 @@ module Mailjet
157
162
  "#{attribute} #{direction}"
158
163
  end.join(', ')
159
164
  end
160
- params
165
+ camelcase_keys params
161
166
  end
162
167
 
163
168
  def camelcase_keys(hash)
@@ -170,7 +175,15 @@ module Mailjet
170
175
 
171
176
  def map_keys(hash, method)
172
177
  hash.inject({}) do |_hash, (key, value)|
173
- new_key = key.to_s.send(method)
178
+ # new_key = key.to_s.send(method)
179
+ new_key =
180
+ if key == "text_part"
181
+ 'Text-part'
182
+ elsif key == "html_part"
183
+ 'Html-part'
184
+ else
185
+ key.to_s.send(method)
186
+ end
174
187
  _hash[new_key] = value
175
188
  _hash
176
189
  end
@@ -194,6 +207,11 @@ module Mailjet
194
207
  response = connection.post(formatted_payload, default_headers)
195
208
  end
196
209
 
210
+ if self.resource_path == 'v3/send/'
211
+ self.attributes = ActiveSupport::JSON.decode(response)
212
+ return true
213
+ end
214
+
197
215
  self.attributes = parse_api_json(response).first
198
216
  return true
199
217
  rescue Mailjet::ApiError => e
@@ -0,0 +1,12 @@
1
+ require 'mailjet/resource'
2
+
3
+ module Mailjet
4
+ class Aggregategraphstatistics
5
+ include Mailjet::Resource
6
+ self.resource_path = 'v3/REST/aggregategraphstatistics'
7
+ self.public_operations = [:get]
8
+ self.filters = [:campaign_aggregate_id, :range]
9
+ self.resourceprop = [:blocked_count, :blocked_std_dev, :bounced_count, :bounced_std_dev, :campaign_aggregate_id, :clicked_count, :clicked_std_dev, :opened_count, :open_std_dev, :ref_time_stamp, :sent_count, :sent_std_dev, :spam_complaint_count, :spam_complaint_std_dev, :unsubscribe_count, :unsubscribe_std_dev]
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require 'mailjet/resource'
2
+
3
+ module Mailjet
4
+ class Campaignaggregate
5
+ include Mailjet::Resource
6
+ self.resource_path = 'v3/REST/campaignaggregate'
7
+ self.public_operations = [:get, :post, :put, :delete]
8
+ self.filters = [:contact_filter, :contacts_list, :sender]
9
+ self.resourceprop = [:campaign_ids, :contact_filter_id, :campaign_filter_alt, :contacts_list_id, :contacts_list_alt, :final, :form_date, :id, :keyword, :name, :sender_id, :sender_alt, :to_dat]
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require 'mailjet/resource'
2
+
3
+ module Mailjet
4
+ class Campaigngraphstatistics
5
+ include Mailjet::Resource
6
+ self.resource_path = 'v3/REST/campaigngraphstatistics'
7
+ self.public_operations = [:get]
8
+ self.filters = [:click, :ids, :open, :range, :spam, :unsub]
9
+ self.resourceprop = [:click_count, :id, :opencount, :spamcount, :tick, :unsubcount]
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require 'mailjet/resource'
2
+
3
+ module Mailjet
4
+ class Campaignoverview
5
+ include Mailjet::Resource
6
+ self.resource_path = 'v3/REST/campaignoverview'
7
+ self.public_operations = [:get]
8
+ self.filters = [:archived, :drafts, :programmed, :sent, :starred, :subject]
9
+ self.resourceprop = [:titled, :subject, :status, :starred, :sent_time_start, :processed_count, :opened_count, :id_type, :id, :edit_type, :edit_mode, :clicked_count]
10
+
11
+ end
12
+ end
@@ -6,7 +6,7 @@ module Mailjet
6
6
  self.resource_path = 'v3/REST/newsletter'
7
7
  self.public_operations = [:get, :put, :post]
8
8
  self.filters = [:campaign, :contacts_list, :delivered_at, :edit_mode, :is_archived, :is_campaign, :is_deleted, :is_handled, :is_starred, :modified, :news_letter_template, :segmentation, :status, :subject]
9
- self.resourceprop = [:callback, :campaign, :contacts_list, :created_at, :delivered_at, :edit_mode, :edit_type, :footer, :footer_address, :footer_wysiwyg_type, :header_filename, :header_link, :header_text, :header_url, :id, :ip, :is_handled, :is_starred, :is_text_part_included, :locale, :modified_at, :permalink, :permalink_host, :permalink_wysiwyg_type, :politeness_mode, :reply_email, :segmentation, :sender, :sender_email, :sender_name, :status, :subject, :template, :test_address, :title, :url, 'CampaignID', 'CampaignALT', 'ContactsListID', 'ContactsListALT', 'SegmentationID', 'SegmentationALT']
9
+ self.resourceprop = [:callback, :campaign, :contacts_list, :created_at, :delivered_at, :edit_mode, :edit_type, :footer, :footer_address, :footer_wysiwyg_type, :header_filename, :header_link, :header_text, :header_url, :id, :ip, :is_handled, :is_starred, :is_text_part_included, :locale, :modified_at, :permalink, :permalink_host, :permalink_wysiwyg_type, :politeness_mode, :reply_email, :segmentation, :sender, :sender_email, :sender_name, :status, :subject, :template, :test_address, :title, :url, 'CampaignID', 'CampaignALT', 'ContactsListID', 'ContactsListALT', 'SegmentationID', 'SegmentationALT', :contacts_list_id]
10
10
 
11
11
  end
12
12
  end
@@ -7,7 +7,7 @@ module Mailjet
7
7
  self.resource_path = "v3/REST/newsletter/id/#{self.action}"
8
8
  self.public_operations = [:get, :put, :post, :delete]
9
9
  self.filters = []
10
- self.resourceprop = ["Text-part", "Html-part"]
10
+ self.resourceprop = [:text_part, :html_part]
11
11
 
12
12
  end
13
13
  end
@@ -0,0 +1,13 @@
1
+ require 'mailjet/resource'
2
+
3
+ module Mailjet
4
+ class Newsletter_status
5
+ include Mailjet::Resource
6
+ self.action = 'status'
7
+ self.resource_path = "v3/REST/newsletter/id/#{self.action}"
8
+ self.public_operations = [:get]
9
+ self.filters = []
10
+ self.resourceprop = []
11
+
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ require 'mailjet/resource'
2
+
3
+ module Mailjet
4
+ class Send
5
+ include Mailjet::Resource
6
+ self.resource_path = 'v3/send/'
7
+ self.public_operations = [:post]
8
+ self.resourceprop = [:from_email, :from_name, :recipients, :subject, :text_part, :html_part, :attachments, :inline_attachments, :headers, 'Mj-TemplateID', 'Mj-CustomID', :message_id, :messages]
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+
2
+ require 'mailjet/resource'
3
+
4
+ module Mailjet
5
+ class Sender_validate
6
+ include Mailjet::Resource
7
+ self.action = "validate"
8
+ self.resource_path = "v3/REST/sender/id/#{self.action}"
9
+ self.public_operations = [:post]
10
+ self.filters = []
11
+ self.resourceprop = []
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Mailjet
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailjet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Nappy
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-11-12 00:00:00.000000000 Z
14
+ date: 2016-01-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -289,6 +289,7 @@ files:
289
289
  - lib/mailjet/rack/endpoint.rb
290
290
  - lib/mailjet/reporting.rb
291
291
  - lib/mailjet/resource.rb
292
+ - lib/mailjet/resources/aggregategraphstatistics.rb
292
293
  - lib/mailjet/resources/apikey.rb
293
294
  - lib/mailjet/resources/apikeyaccess.rb
294
295
  - lib/mailjet/resources/apikeytotals.rb
@@ -297,6 +298,9 @@ files:
297
298
  - lib/mailjet/resources/batchjob.rb
298
299
  - lib/mailjet/resources/bouncestatistics.rb
299
300
  - lib/mailjet/resources/campaign.rb
301
+ - lib/mailjet/resources/campaignaggregate.rb
302
+ - lib/mailjet/resources/campaigngraphstatistics.rb
303
+ - lib/mailjet/resources/campaignoverview.rb
300
304
  - lib/mailjet/resources/campaignstatistics.rb
301
305
  - lib/mailjet/resources/clickstatistics.rb
302
306
  - lib/mailjet/resources/contact.rb
@@ -336,6 +340,7 @@ files:
336
340
  - lib/mailjet/resources/newsletter_detailcontent.rb
337
341
  - lib/mailjet/resources/newsletter_schedule.rb
338
342
  - lib/mailjet/resources/newsletter_send.rb
343
+ - lib/mailjet/resources/newsletter_status.rb
339
344
  - lib/mailjet/resources/newsletter_test.rb
340
345
  - lib/mailjet/resources/newsletterblock.rb
341
346
  - lib/mailjet/resources/newsletterproperties.rb
@@ -347,7 +352,9 @@ files:
347
352
  - lib/mailjet/resources/openstatistics.rb
348
353
  - lib/mailjet/resources/parseroute.rb
349
354
  - lib/mailjet/resources/preferences.rb
355
+ - lib/mailjet/resources/send.rb
350
356
  - lib/mailjet/resources/sender.rb
357
+ - lib/mailjet/resources/sender_validate.rb
351
358
  - lib/mailjet/resources/senderstatistics.rb
352
359
  - lib/mailjet/resources/toplinkclicked.rb
353
360
  - lib/mailjet/resources/trigger.rb