-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from philoye/transactional-v1
Transactional v1
- Loading branch information
Showing
22 changed files
with
647 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
language: ruby | ||
rvm: | ||
- 2.2 | ||
- 2.1 | ||
- 2.0.0 | ||
- 1.9.3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module CreateSend | ||
module Transactional | ||
class ClassicEmail < CreateSend | ||
attr_accessor :options | ||
|
||
def initialize(auth, client_id = nil) | ||
@auth = auth | ||
@client_id = client_id | ||
super | ||
end | ||
|
||
def send(options) | ||
response = post "/transactional/classicemail/send", { :body => options.to_json , :query => client_id } | ||
response.map{|item| Hashie::Mash.new(item)} | ||
end | ||
|
||
def groups | ||
response = get "/transactional/classicemail/groups", :query => client_id | ||
response.map{|item| Hashie::Mash.new(item)} | ||
end | ||
|
||
private | ||
|
||
def client_id | ||
{:clientID => @client_id} if @client_id | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module CreateSend | ||
module Transactional | ||
class SmartEmail < CreateSend | ||
attr_reader :smart_email_id | ||
|
||
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 | ||
|
||
def initialize(auth, smart_email_id) | ||
@auth = auth | ||
@smart_email_id = smart_email_id | ||
super | ||
end | ||
|
||
def details | ||
response = get "/transactional/smartemail/#{@smart_email_id}" | ||
Hashie::Mash.new(response) | ||
end | ||
|
||
def send(options) | ||
response = post "/transactional/smartemail/#{@smart_email_id}/send", { :body => options.to_json } | ||
response.map{|item| Hashie::Mash.new(item)} | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
module CreateSend | ||
module Transactional | ||
class Timeline < CreateSend | ||
attr_reader :client_id | ||
|
||
def initialize(auth, client_id = nil) | ||
@auth = auth | ||
@client_id = client_id | ||
super | ||
end | ||
|
||
def messages(options = {}) | ||
options = add_client_id(options) | ||
response = get "/transactional/messages", { :query => options } | ||
response.map{|item| Hashie::Mash.new(item)} | ||
end | ||
|
||
def statistics(options = {}) | ||
options = add_client_id(options) | ||
response = get "/transactional/statistics", { :query => options } | ||
Hashie::Mash.new(response) | ||
end | ||
|
||
def details(message_id, options = {}) | ||
options = add_client_id(options) | ||
response = get "/transactional/messages/#{message_id}", { :query => options } | ||
Hashie::Mash.new(response) | ||
end | ||
|
||
def resend(message_id) | ||
response = post "/transactional/messages/#{message_id}/resend" | ||
response.map{|item| Hashie::Mash.new(item)} | ||
end | ||
|
||
private | ||
|
||
def add_client_id(options) | ||
options['clientID'] = @client_id if @client_id | ||
options | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"Group": "Password Reset", | ||
"CreatedAt": "2015-03-28T09:41:36+11:00" | ||
}, | ||
{ | ||
"Group": "Credit card expired", | ||
"CreatedAt": "2015-05-04T22:24:12+10:00" | ||
}, | ||
{ | ||
"Group": "Order shipped", | ||
"CreatedAt": "2015-03-29T11:11:52+11:00" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd", | ||
"Status": "Delivered", | ||
"SentAt": "2014-01-15T16:09:19-05:00", | ||
"SmartEmailID": "c0da9c4c-e7e4-11e4-a74d-6c4008bc7468", | ||
"CanBeResent": true, | ||
"Recipient": "Joe Smith <[email protected]>", | ||
"Message": { | ||
"From": "Team Webapp <[email protected]", | ||
"Subject": "Thanks for signing up to web app 123", | ||
"To": [ | ||
"Joe Smith <[email protected]>", | ||
"[email protected]" | ||
], | ||
"CC": [ | ||
"Joe Smith <[email protected]>" | ||
], | ||
"BCC": "[email protected]", | ||
"Attachments": [ | ||
{ | ||
"Name": "Invoice.pdf", | ||
"Type": "application/pdf" | ||
} | ||
], | ||
"Body": { | ||
"Html": "...", | ||
"Text": "..." | ||
}, | ||
"Data": { | ||
"new_password_url": "https://www.mywebapp.com/newpassword?uid=jguf45hf74hbf74gf" | ||
} | ||
}, | ||
"TotalOpens": 1, | ||
"TotalClicks": 1 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd", | ||
"Status": "Delivered", | ||
"SentAt": "2014-01-15T16:09:19-05:00", | ||
"SmartEmailID": "c0da9c4c-e7e4-11e4-a74d-6c4008bc7468", | ||
"CanBeResent": true, | ||
"Recipient": "Joe Smith <[email protected]>", | ||
"Message": { | ||
"From": "Team Webapp <[email protected]", | ||
"Subject": "Thanks for signing up to web app 123", | ||
"To": [ | ||
"Joe Smith <[email protected]>", | ||
"[email protected]" | ||
], | ||
"CC": [ | ||
"Joe Smith <[email protected]>" | ||
], | ||
"BCC": "[email protected]", | ||
"Attachments": [ | ||
{ | ||
"Name": "Invoice.pdf", | ||
"Type": "application/pdf" | ||
} | ||
], | ||
"Body": { | ||
"Html": "...", | ||
"Text": "..." | ||
}, | ||
"Data": { | ||
"new_password_url": "https://www.mywebapp.com/newpassword?uid=jguf45hf74hbf74gf" | ||
} | ||
}, | ||
"TotalOpens": 1, | ||
"TotalClicks": 1, | ||
"Opens": [ | ||
{ | ||
"EmailAddress": "[email protected]", | ||
"Date": "2009-05-18 16:45:00", | ||
"IPAddress": "192.168.0.1", | ||
"Geolocation": { | ||
"Latitude": -33.8683, | ||
"Longitude": 151.2086, | ||
"City": "Sydney", | ||
"Region": "New South Wales", | ||
"CountryCode": "AU", | ||
"CountryName": "Australia" | ||
}, | ||
"MailClient": { | ||
"Name": "Apple Mail", | ||
"OS": "OS X", | ||
"Device": "Desktop" | ||
} | ||
} | ||
], | ||
"Clicks": [ | ||
{ | ||
"EmailAddress": "[email protected]", | ||
"Date": "2009-05-18 16:45:00", | ||
"IPAddress": "192.168.0.1", | ||
"URL": "http://www.myexammple.com/index.html", | ||
"Geolocation": { | ||
"Latitude": -33.8683, | ||
"Longitude": 151.2086, | ||
"City": "Sydney", | ||
"Region": "New South Wales", | ||
"CountryCode": "AU", | ||
"CountryName": "Australia" | ||
} | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[ | ||
{ | ||
"MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd", | ||
"Status": "Delivered", | ||
"SentAt": "2014-01-15T16:09:19-05:00", | ||
"Recipient": "Joe Smith <[email protected]>", | ||
"From": "Team <[email protected]>", | ||
"Subject": "Ungrouped message", | ||
"TotalOpens": 2, | ||
"TotalClicks": 4, | ||
"CanBeResent": true | ||
}, | ||
{ | ||
"MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd", | ||
"Status": "Delivered", | ||
"SentAt": "2014-01-15T16:09:19-05:00", | ||
"Recipient": "Joe Smith <[email protected]>", | ||
"From": "Team <[email protected]>", | ||
"Subject": "Your password has been reset", | ||
"TotalOpens": 2, | ||
"TotalClicks": 4, | ||
"CanBeResent": true, | ||
"Group": "Password Reset" | ||
}, | ||
{ | ||
"MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd", | ||
"Status": "Delivered", | ||
"SentAt": "2014-01-15T16:09:19-05:00", | ||
"Recipient": "Joe Smith <[email protected]>", | ||
"From": "Team <[email protected]>", | ||
"Subject": "Your credit card has expired", | ||
"TotalOpens": 2, | ||
"TotalClicks": 4, | ||
"CanBeResent": true, | ||
"SmartEmailID": "21dab350-f484-11e4-ad38-6c4008bc7468" | ||
} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[ | ||
{ | ||
"MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd", | ||
"Status": "Delivered", | ||
"SentAt": "2014-01-15T16:09:19-05:00", | ||
"Recipient": "Joe Smith <[email protected]>", | ||
"From": "Team <[email protected]>", | ||
"Subject": "Your password has been reset", | ||
"TotalOpens": 2, | ||
"TotalClicks": 4, | ||
"CanBeResent": true, | ||
"Group": "Password Reset" | ||
} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[ | ||
{ | ||
"MessageID": "ddc697c7-0788-4df3-a71a-a7cb935f00bd", | ||
"Status": "Delivered", | ||
"SentAt": "2014-01-15T16:09:19-05:00", | ||
"Recipient": "Joe Smith <[email protected]>", | ||
"From": "Team <[email protected]>", | ||
"Subject": "Your credit card has expired", | ||
"TotalOpens": 2, | ||
"TotalClicks": 4, | ||
"CanBeResent": true, | ||
"SmartEmailID": "21dab350-f484-11e4-ad38-6c4008bc7468" | ||
} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"Status": "Accepted", | ||
"Recipient": "Joe Smith <[email protected]>", | ||
"MessageID": "cfb5e081-ef66-4bc4-a1c0-48493b34e694" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ | ||
{ | ||
"MessageID": "0cfe150d-d507-11e4-84a7-c31e5b59881d", | ||
"Recipient": "\"Bob Sacamano\" <[email protected]>", | ||
"Status": "Received" | ||
}, | ||
{ | ||
"MessageID": "0cfe150d-d507-11e4-b579-a64eb0d9c74d", | ||
"Recipient": "\"Newman\" <[email protected]>", | ||
"Status": "Received" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ | ||
"MessageID": "0cfe150d-d507-11e4-84a7-c31e5b59881d", | ||
"Recipient": "\"Bob Sacamano\" <[email protected]>", | ||
"Status": "Received" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"SmartEmailID": "bb4a6ebb-663d-42a0-bdbe-60512cf30a01", | ||
"Name": "Reset Password", | ||
"CreatedAt": "2015-03-31T16:06:35+11:00", | ||
"Status": "active", | ||
"Properties": { | ||
"From": "\"Team\" <[email protected]>", | ||
"ReplyTo": "[email protected]", | ||
"Subject": "[username], your password has been reset!", | ||
"Content": { | ||
"HTML": "Content managed in Email Builder", | ||
"Text": "Content managed in Email Builder", | ||
"EmailVariables": [ | ||
"username", | ||
"reset_token" | ||
], | ||
"InlineCss": true | ||
}, | ||
"TextPreviewUrl": "https://philoye.devcreatesend.com/t/r-9A7A28EE76054977/T", | ||
"HtmlPreviewUrl": "https://philoye.devcreatesend.com/t/r-9A7A28EE76054977/" | ||
}, | ||
"AddRecipientsToList": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[ | ||
{ | ||
"ID": "1e654df2-f484-11e4-970c-6c4008bc7468", | ||
"Name": "Welcome email", | ||
"CreatedAt": "2015-05-15T16:09:19-05:00", | ||
"Status": "Active" | ||
}, | ||
{ | ||
"ID": "21dab350-f484-11e4-ad38-6c4008bc7468", | ||
"Name": "Order shipped", | ||
"CreatedAt": "2015-05-15T13:29:49-05:00", | ||
"Status": "Active" | ||
} | ||
] | ||
|
Oops, something went wrong.