MailchimpTransactional 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2d3a432c47a5ca0bd269dfe8c9c783e256fdfa1db9752d30dd5ff1743256755a
4
+ data.tar.gz: cceba483082cc7edb39870625f75ba4bd5d14a8208d8323317d785c59bd42735
5
+ SHA512:
6
+ metadata.gz: 316c3790329b72491b192a7eb772f1b55f7edc4d021310597a2900ddb6a7ba4f6eac2c969a62473eca81e03258b6a38f13d81a252fa663133685cc810f4a462a
7
+ data.tar.gz: 2c90408f2b8e846bce4a3f2f839fe5a53069e1c85d8f55f7552f156a65a9f8f3a0fcccb4207f81e24ef54b609237f5d0d663088d105af8a17012b40a0dcff20b
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 12.0.0'
7
+ end
@@ -0,0 +1,45 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ =begin
4
+ #Mailchimp Transactional API
5
+
6
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
7
+
8
+ OpenAPI spec version: 1.0.4
9
+ Contact: apihelp@mandrill.com
10
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
11
+ Swagger Codegen version: 2.4.12
12
+
13
+ =end
14
+
15
+ $:.push File.expand_path("../lib", __FILE__)
16
+ require "MailchimpTransactional/version"
17
+
18
+ Gem::Specification.new do |s|
19
+ s.name = "MailchimpTransactional"
20
+ s.version = MailchimpTransactional::VERSION
21
+ s.platform = Gem::Platform::RUBY
22
+ s.authors = ["Swagger-Codegen"]
23
+ s.email = ["apihelp@mandrill.com"]
24
+ s.homepage = "https://github.com/swagger-api/swagger-codegen"
25
+ s.summary = "Mailchimp Transactional API Ruby Gem"
26
+ s.description = "Mailchimp Transactional Ruby SDK"
27
+ s.license = 'Apache-2.0'
28
+ s.required_ruby_version = ">= 1.9"
29
+
30
+ s.add_runtime_dependency 'faraday', '~> 1.0', '>= 1.0.1'
31
+ s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
32
+
33
+ s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
34
+ s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
35
+ s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
36
+ s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
37
+ s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
38
+ s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
39
+ s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
40
+
41
+ s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
42
+ s.test_files = `find spec/*`.split("\n")
43
+ s.executables = []
44
+ s.require_paths = ["lib"]
45
+ end
@@ -0,0 +1,174 @@
1
+ # Mailchimp Transactional SDK — Ruby
2
+
3
+ The official Ruby SDK for the Mailchimp Transactional API (v1)
4
+
5
+ ## Installation
6
+
7
+ ### Build a gem
8
+
9
+ To build the Ruby code into a gem:
10
+
11
+ ```shell
12
+ gem build MailchimpTransactional.gemspec
13
+ ```
14
+
15
+ Then either install the gem locally:
16
+
17
+ ```shell
18
+ gem install ./MailchimpTransactional-1.0.4.gem
19
+ ```
20
+ (for development, run `gem install --dev ./MailchimpTransactional-1.0.4.gem` to install the development dependencies)
21
+
22
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
23
+
24
+ Finally add this to the Gemfile:
25
+
26
+ gem 'MailchimpTransactional', '~> 1.0.4'
27
+
28
+ ### Install from Git
29
+
30
+ If the Ruby gem is hosted at a git repository: https://github.com/postlight/mailchimp-transactional-ruby, then add the following in the Gemfile:
31
+
32
+ gem 'MailchimpTransactional', :git => 'https://github.com/postlight/mailchimp-transactional-ruby.git'
33
+
34
+ ### Include the Ruby code directly
35
+
36
+ Include the Ruby code directly using `-I` as follows:
37
+
38
+ ```shell
39
+ ruby -Ilib script.rb
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ```ruby
45
+ require 'MailchimpTransactional'
46
+
47
+ begin
48
+ client = MailchimpTransactional::Client.new(ENV['MANDRILL_KEY'])
49
+ result = client.users.ping() # => 'PONG!'
50
+ p result
51
+ rescue MailchimpTransactional::ApiError => e
52
+ puts "Error: #{e}"
53
+ end
54
+ ```
55
+
56
+ ## Sending Requests
57
+ All requests are sent via POST and accept a single argument as the request body parameter.
58
+ ```ruby
59
+ mailchimp.templates.publish({ :name => 'My Template' });
60
+ ```
61
+
62
+ ## Output Formats
63
+ Optionally, you can set the default response format for **all requests** to one of the following:
64
+ - `json` *(default)*
65
+ - `xml`
66
+ - `php`
67
+ - `yaml`
68
+
69
+ ```ruby
70
+ mailchimp.set_default_output_format('xml');
71
+ ```
72
+
73
+ You can also set the response format for a **single request** by passing in a special `outputFormat` param to the request body.
74
+ ```ruby
75
+ mailchimp.senders.list({ :outputFormat => 'php' });
76
+ ```
77
+
78
+ ## API Endpoints
79
+
80
+ All URIs are relative to *https://mandrillapp.com/api/1.0*
81
+
82
+ | SDK Method | Endpoint |
83
+ | ---------- | -------- |
84
+ | **exports.activity** | /exports/activity |
85
+ | **exports.info** | /exports/info |
86
+ | **exports.list** | /exports/list |
87
+ | **exports.rejects** | /exports/rejects |
88
+ | **exports.whitelist** | /exports/whitelist |
89
+ | **inbound.add_domain** | /inbound/add-domain |
90
+ | **inbound.add_route** | /inbound/add-route |
91
+ | **inbound.check_domain** | /inbound/check-domain |
92
+ | **inbound.delete_domain** | /inbound/delete-domain |
93
+ | **inbound.delete_route** | /inbound/delete-route |
94
+ | **inbound.domains** | /inbound/domains |
95
+ | **inbound.routes** | /inbound/routes |
96
+ | **inbound.send_raw** | /inbound/send-raw |
97
+ | **inbound.update_route** | /inbound/update-route |
98
+ | **ips.cancel_warmup** | /ips/cancel-warmup |
99
+ | **ips.check_custom_dns** | /ips/check-custom-dns |
100
+ | **ips.create_pool** | /ips/create-pool |
101
+ | **ips.delete** | /ips/delete |
102
+ | **ips.delete_pool** | /ips/delete-pool |
103
+ | **ips.info** | /ips/info |
104
+ | **ips.list** | /ips/list |
105
+ | **ips.list_pools** | /ips/list-pools |
106
+ | **ips.pool_info** | /ips/pool-info |
107
+ | **ips.provision** | /ips/provision |
108
+ | **ips.set_custom_dns** | /ips/set-custom-dns |
109
+ | **ips.set_pool** | /ips/set-pool |
110
+ | **ips.start_warmup** | /ips/start-warmup |
111
+ | **messages.cancel_scheduled** | /messages/cancel-scheduled |
112
+ | **messages.content** | /messages/content |
113
+ | **messages.info** | /messages/info |
114
+ | **messages.list_scheduled** | /messages/list-scheduled |
115
+ | **messages.parse** | /messages/parse |
116
+ | **messages.reschedule** | /messages/reschedule |
117
+ | **messages.search** | /messages/search |
118
+ | **messages.search_time_series** | /messages/search-time-series |
119
+ | **messages.send** | /messages/send |
120
+ | **messages.send_raw** | /messages/send-raw |
121
+ | **messages.send_template** | /messages/send-template |
122
+ | **metadata.add** | /metadata/add |
123
+ | **metadata.delete** | /metadata/delete |
124
+ | **metadata.list** | /metadata/list |
125
+ | **metadata.update** | /metadata/update |
126
+ | **rejects.add** | /rejects/add |
127
+ | **rejects.delete** | /rejects/delete |
128
+ | **rejects.list** | /rejects/list |
129
+ | **senders.add_domain** | /senders/add-domain |
130
+ | **senders.check_domain** | /senders/check-domain |
131
+ | **senders.domains** | /senders/domains |
132
+ | **senders.info** | /senders/info |
133
+ | **senders.list** | /senders/list |
134
+ | **senders.time_series** | /senders/time-series |
135
+ | **senders.verify_domain** | /senders/verify-domain |
136
+ | **subaccounts.add** | /subaccounts/add |
137
+ | **subaccounts.delete** | /subaccounts/delete |
138
+ | **subaccounts.info** | /subaccounts/info |
139
+ | **subaccounts.list** | /subaccounts/list |
140
+ | **subaccounts.pause** | /subaccounts/pause |
141
+ | **subaccounts.resume** | /subaccounts/resume |
142
+ | **subaccounts.update** | /subaccounts/update |
143
+ | **tags.all_time_series** | /tags/all-time-series |
144
+ | **tags.delete** | /tags/delete |
145
+ | **tags.info** | /tags/info |
146
+ | **tags.list** | /tags/list |
147
+ | **tags.time_series** | /tags/time-series |
148
+ | **templates.add** | /templates/add |
149
+ | **templates.delete** | /templates/delete |
150
+ | **templates.info** | /templates/info |
151
+ | **templates.list** | /templates/list |
152
+ | **templates.publish** | /templates/publish |
153
+ | **templates.render** | /templates/render |
154
+ | **templates.time_series** | /templates/time-series |
155
+ | **templates.update** | /templates/update |
156
+ | **urls.add_tracking_domain** | /urls/add-tracking-domain |
157
+ | **urls.check_tracking_domain** | /urls/check-tracking-domain |
158
+ | **urls.list** | /urls/list |
159
+ | **urls.search** | /urls/search |
160
+ | **urls.time_series** | /urls/time-series |
161
+ | **urls.tracking_domains** | /urls/tracking-domains |
162
+ | **users.info** | /users/info |
163
+ | **users.ping** | /users/ping |
164
+ | **users.ping2** | /users/ping2 |
165
+ | **users.senders** | /users/senders |
166
+ | **webhooks.add** | /webhooks/add |
167
+ | **webhooks.delete** | /webhooks/delete |
168
+ | **webhooks.info** | /webhooks/info |
169
+ | **webhooks.list** | /webhooks/list |
170
+ | **webhooks.update** | /webhooks/update |
171
+ | **whitelists.add** | /whitelists/add |
172
+ | **whitelists.delete** | /whitelists/delete |
173
+ | **whitelists.list** | /whitelists/list |
174
+
@@ -0,0 +1,123 @@
1
+ =begin
2
+ #Mailchimp Transactional API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.4
7
+ Contact: apihelp@mandrill.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.12
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'MailchimpTransactional/api_client'
15
+ require 'MailchimpTransactional/api_error'
16
+ require 'MailchimpTransactional/version'
17
+
18
+
19
+ # APIs
20
+ require 'MailchimpTransactional/api/exports_api'
21
+ require 'MailchimpTransactional/api/inbound_api'
22
+ require 'MailchimpTransactional/api/ips_api'
23
+ require 'MailchimpTransactional/api/messages_api'
24
+ require 'MailchimpTransactional/api/metadata_api'
25
+ require 'MailchimpTransactional/api/rejects_api'
26
+ require 'MailchimpTransactional/api/senders_api'
27
+ require 'MailchimpTransactional/api/subaccounts_api'
28
+ require 'MailchimpTransactional/api/tags_api'
29
+ require 'MailchimpTransactional/api/templates_api'
30
+ require 'MailchimpTransactional/api/urls_api'
31
+ require 'MailchimpTransactional/api/users_api'
32
+ require 'MailchimpTransactional/api/webhooks_api'
33
+ require 'MailchimpTransactional/api/whitelists_api'
34
+
35
+ module MailchimpTransactional
36
+ class Client
37
+ def initialize(api_key = '')
38
+ @api_key = api_key
39
+ @api_client = ApiClient.new()
40
+
41
+ @Exports = ExportsApi.new(@api_key, @api_client)
42
+ @Inbound = InboundApi.new(@api_key, @api_client)
43
+ @Ips = IpsApi.new(@api_key, @api_client)
44
+ @Messages = MessagesApi.new(@api_key, @api_client)
45
+ @Metadata = MetadataApi.new(@api_key, @api_client)
46
+ @Rejects = RejectsApi.new(@api_key, @api_client)
47
+ @Senders = SendersApi.new(@api_key, @api_client)
48
+ @Subaccounts = SubaccountsApi.new(@api_key, @api_client)
49
+ @Tags = TagsApi.new(@api_key, @api_client)
50
+ @Templates = TemplatesApi.new(@api_key, @api_client)
51
+ @Urls = UrlsApi.new(@api_key, @api_client)
52
+ @Users = UsersApi.new(@api_key, @api_client)
53
+ @Webhooks = WebhooksApi.new(@api_key, @api_client)
54
+ @Whitelists = WhitelistsApi.new(@api_key, @api_client)
55
+ end
56
+
57
+ def set_api_key(api_key = '')
58
+ @api_key = api_key
59
+
60
+ @Exports = ExportsApi.new(@api_key, @api_client)
61
+ @Inbound = InboundApi.new(@api_key, @api_client)
62
+ @Ips = IpsApi.new(@api_key, @api_client)
63
+ @Messages = MessagesApi.new(@api_key, @api_client)
64
+ @Metadata = MetadataApi.new(@api_key, @api_client)
65
+ @Rejects = RejectsApi.new(@api_key, @api_client)
66
+ @Senders = SendersApi.new(@api_key, @api_client)
67
+ @Subaccounts = SubaccountsApi.new(@api_key, @api_client)
68
+ @Tags = TagsApi.new(@api_key, @api_client)
69
+ @Templates = TemplatesApi.new(@api_key, @api_client)
70
+ @Urls = UrlsApi.new(@api_key, @api_client)
71
+ @Users = UsersApi.new(@api_key, @api_client)
72
+ @Webhooks = WebhooksApi.new(@api_key, @api_client)
73
+ @Whitelists = WhitelistsApi.new(@api_key, @api_client)
74
+ end
75
+
76
+ def set_default_output_format(output_format)
77
+ @api_client.set_default_output_format(output_format)
78
+ end
79
+
80
+ def exports
81
+ @Exports
82
+ end
83
+ def inbound
84
+ @Inbound
85
+ end
86
+ def ips
87
+ @Ips
88
+ end
89
+ def messages
90
+ @Messages
91
+ end
92
+ def metadata
93
+ @Metadata
94
+ end
95
+ def rejects
96
+ @Rejects
97
+ end
98
+ def senders
99
+ @Senders
100
+ end
101
+ def subaccounts
102
+ @Subaccounts
103
+ end
104
+ def tags
105
+ @Tags
106
+ end
107
+ def templates
108
+ @Templates
109
+ end
110
+ def urls
111
+ @Urls
112
+ end
113
+ def users
114
+ @Users
115
+ end
116
+ def webhooks
117
+ @Webhooks
118
+ end
119
+ def whitelists
120
+ @Whitelists
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,176 @@
1
+ =begin
2
+ #Mailchimp Transactional API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.4
7
+ Contact: apihelp@mandrill.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.12
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module MailchimpTransactional
16
+ class ExportsApi
17
+ attr_accessor :api_client
18
+
19
+ attr_accessor :api_key
20
+
21
+ def initialize(api_key = '', api_client = ApiClient.default)
22
+ @api_key = api_key
23
+ @api_client = api_client
24
+ end
25
+ # /exports/activity
26
+ # Begins an export of your activity history. The activity will be exported to a zip archive containing a single file named activity.csv in the same format as you would be able to export from your account's activity view. It includes the following fields: Date, Email Address, Sender, Subject, Status, Tags, Opens, Clicks, Bounce Detail. If you have configured any custom metadata fields, they will be included in the exported data.
27
+ # @param body
28
+ # @param [Hash] opts the optional parameters
29
+ # @return [InlineResponse2004]
30
+ def activity(body = {}, opts = {})
31
+ data, _status_code, _headers = activity_with_http_info(body, opts)
32
+ data
33
+ end
34
+
35
+ # /exports/activity
36
+ # Begins an export of your activity history. The activity will be exported to a zip archive containing a single file named activity.csv in the same format as you would be able to export from your account's activity view. It includes the following fields: Date, Email Address, Sender, Subject, Status, Tags, Opens, Clicks, Bounce Detail. If you have configured any custom metadata fields, they will be included in the exported data.
37
+ # @param body
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [Array<(InlineResponse2004, Fixnum, Hash)>] InlineResponse2004 data, response status code and response headers
40
+ def activity_with_http_info(body, opts = {})
41
+ # add api key to request body
42
+ body[:key] = @api_key
43
+
44
+ # resource path
45
+ local_var_path = '/exports/activity'
46
+
47
+ # http body (model)
48
+ auth_names = []
49
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
50
+ :body => body,
51
+ :auth_names => auth_names,
52
+ :return_type => 'InlineResponse2004')
53
+ return data, status_code, headers
54
+ end
55
+ # /exports/info
56
+ # Returns information about an export job. If the export job's state is 'complete', the returned data will include a URL you can use to fetch the results. Every export job produces a zip archive, but the format of the archive is distinct for each job type. The api calls that initiate exports include more details about the output format for that job type.
57
+ # @param body
58
+ # @param [Hash] opts the optional parameters
59
+ # @return [InlineResponse200]
60
+ def info(body = {}, opts = {})
61
+ data, _status_code, _headers = info_with_http_info(body, opts)
62
+ data
63
+ end
64
+
65
+ # /exports/info
66
+ # Returns information about an export job. If the export job&#39;s state is &#39;complete&#39;, the returned data will include a URL you can use to fetch the results. Every export job produces a zip archive, but the format of the archive is distinct for each job type. The api calls that initiate exports include more details about the output format for that job type.
67
+ # @param body
68
+ # @param [Hash] opts the optional parameters
69
+ # @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers
70
+ def info_with_http_info(body, opts = {})
71
+ # add api key to request body
72
+ body[:key] = @api_key
73
+
74
+ # resource path
75
+ local_var_path = '/exports/info'
76
+
77
+ # http body (model)
78
+ auth_names = []
79
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
80
+ :body => body,
81
+ :auth_names => auth_names,
82
+ :return_type => 'InlineResponse200')
83
+ return data, status_code, headers
84
+ end
85
+ # /exports/list
86
+ # Returns a list of your exports.
87
+ # @param body
88
+ # @param [Hash] opts the optional parameters
89
+ # @return [Array<InlineResponse2001>]
90
+ def list(body = {}, opts = {})
91
+ data, _status_code, _headers = list_with_http_info(body, opts)
92
+ data
93
+ end
94
+
95
+ # /exports/list
96
+ # Returns a list of your exports.
97
+ # @param body
98
+ # @param [Hash] opts the optional parameters
99
+ # @return [Array<(Array<InlineResponse2001>, Fixnum, Hash)>] Array<InlineResponse2001> data, response status code and response headers
100
+ def list_with_http_info(body, opts = {})
101
+ # add api key to request body
102
+ body[:key] = @api_key
103
+
104
+ # resource path
105
+ local_var_path = '/exports/list'
106
+
107
+ # http body (model)
108
+ auth_names = []
109
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
110
+ :body => body,
111
+ :auth_names => auth_names,
112
+ :return_type => 'Array<InlineResponse2001>')
113
+ return data, status_code, headers
114
+ end
115
+ # /exports/rejects
116
+ # Begins an export of your rejection blacklist. The blacklist will be exported to a zip archive containing a single file named rejects.csv that includes the following fields: email, reason, detail, created_at, expires_at, last_event_at, expires_at.
117
+ # @param body
118
+ # @param [Hash] opts the optional parameters
119
+ # @return [InlineResponse2002]
120
+ def rejects(body = {}, opts = {})
121
+ data, _status_code, _headers = rejects_with_http_info(body, opts)
122
+ data
123
+ end
124
+
125
+ # /exports/rejects
126
+ # Begins an export of your rejection blacklist. The blacklist will be exported to a zip archive containing a single file named rejects.csv that includes the following fields: email, reason, detail, created_at, expires_at, last_event_at, expires_at.
127
+ # @param body
128
+ # @param [Hash] opts the optional parameters
129
+ # @return [Array<(InlineResponse2002, Fixnum, Hash)>] InlineResponse2002 data, response status code and response headers
130
+ def rejects_with_http_info(body, opts = {})
131
+ # add api key to request body
132
+ body[:key] = @api_key
133
+
134
+ # resource path
135
+ local_var_path = '/exports/rejects'
136
+
137
+ # http body (model)
138
+ auth_names = []
139
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
140
+ :body => body,
141
+ :auth_names => auth_names,
142
+ :return_type => 'InlineResponse2002')
143
+ return data, status_code, headers
144
+ end
145
+ # /exports/whitelist
146
+ # Begins an export of your rejection whitelist. The whitelist will be exported to a zip archive containing a single file named whitelist.csv that includes the following fields: email, detail, created_at.
147
+ # @param body
148
+ # @param [Hash] opts the optional parameters
149
+ # @return [InlineResponse2003]
150
+ def whitelist(body = {}, opts = {})
151
+ data, _status_code, _headers = whitelist_with_http_info(body, opts)
152
+ data
153
+ end
154
+
155
+ # /exports/whitelist
156
+ # Begins an export of your rejection whitelist. The whitelist will be exported to a zip archive containing a single file named whitelist.csv that includes the following fields: email, detail, created_at.
157
+ # @param body
158
+ # @param [Hash] opts the optional parameters
159
+ # @return [Array<(InlineResponse2003, Fixnum, Hash)>] InlineResponse2003 data, response status code and response headers
160
+ def whitelist_with_http_info(body, opts = {})
161
+ # add api key to request body
162
+ body[:key] = @api_key
163
+
164
+ # resource path
165
+ local_var_path = '/exports/whitelist'
166
+
167
+ # http body (model)
168
+ auth_names = []
169
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
170
+ :body => body,
171
+ :auth_names => auth_names,
172
+ :return_type => 'InlineResponse2003')
173
+ return data, status_code, headers
174
+ end
175
+ end
176
+ end