├── .github
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .rubocop.yml
├── CHANGELOG.md
├── Gemfile
├── LICENSE
├── MailchimpTransactional.gemspec
├── README.md
└── lib
├── MailchimpTransactional.rb
└── MailchimpTransactional
├── api
├── allowlists_api.rb
├── exports_api.rb
├── inbound_api.rb
├── ips_api.rb
├── messages_api.rb
├── metadata_api.rb
├── rejects_api.rb
├── senders_api.rb
├── subaccounts_api.rb
├── tags_api.rb
├── templates_api.rb
├── urls_api.rb
├── users_api.rb
├── webhooks_api.rb
└── whitelists_api.rb
├── api_client.rb
├── api_error.rb
├── configuration.rb
└── version.rb
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Note: This repository is auto-generated, and does not accept pull requests.
2 |
3 | To make changes or open issues for this SDK, use the [code generation repository](https://github.com/mailchimp/mailchimp-client-lib-codegen).
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Generated by: https://github.com/swagger-api/swagger-codegen.git
2 | #
3 |
4 | *.gem
5 | *.rbc
6 | /.config
7 | /coverage/
8 | /InstalledFiles
9 | /pkg/
10 | /spec/reports/
11 | /spec/examples.txt
12 | /test/tmp/
13 | /test/version_tmp/
14 | /tmp/
15 |
16 | ## Specific to RubyMotion:
17 | .dat*
18 | .repl_history
19 | build/
20 |
21 | ## Documentation cache and generated files:
22 | /.yardoc/
23 | /_yardoc/
24 | /doc/
25 | /rdoc/
26 |
27 | ## Environment normalization:
28 | /.bundle/
29 | /vendor/bundle
30 | /lib/bundler/man/
31 |
32 | # for a library or gem, you might want to ignore these files since the code is
33 | # intended to run in multiple environments; otherwise, check them in:
34 | # Gemfile.lock
35 | # .ruby-version
36 | # .ruby-gemset
37 |
38 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
39 | .rvmrc
40 |
--------------------------------------------------------------------------------
/.rubocop.yml:
--------------------------------------------------------------------------------
1 | # This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license)
2 | # Automatically generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen)
3 | AllCops:
4 | TargetRubyVersion: 2.2
5 | # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
6 | # to ignore them, so only the ones explicitly set in this file are enabled.
7 | DisabledByDefault: true
8 | Exclude:
9 | - '**/templates/**/*'
10 | - '**/vendor/**/*'
11 | - 'actionpack/lib/action_dispatch/journey/parser.rb'
12 |
13 | # Prefer &&/|| over and/or.
14 | Style/AndOr:
15 | Enabled: true
16 |
17 | # Do not use braces for hash literals when they are the last argument of a
18 | # method call.
19 | Style/BracesAroundHashParameters:
20 | Enabled: true
21 | EnforcedStyle: context_dependent
22 |
23 | # Align `when` with `case`.
24 | Layout/CaseIndentation:
25 | Enabled: true
26 |
27 | # Align comments with method definitions.
28 | Layout/CommentIndentation:
29 | Enabled: true
30 |
31 | Layout/ElseAlignment:
32 | Enabled: true
33 |
34 | Layout/EmptyLineAfterMagicComment:
35 | Enabled: true
36 |
37 | # In a regular class definition, no empty lines around the body.
38 | Layout/EmptyLinesAroundClassBody:
39 | Enabled: true
40 |
41 | # In a regular method definition, no empty lines around the body.
42 | Layout/EmptyLinesAroundMethodBody:
43 | Enabled: true
44 |
45 | # In a regular module definition, no empty lines around the body.
46 | Layout/EmptyLinesAroundModuleBody:
47 | Enabled: true
48 |
49 | Layout/FirstParameterIndentation:
50 | Enabled: true
51 |
52 | # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
53 | Style/HashSyntax:
54 | Enabled: false
55 |
56 | # Method definitions after `private` or `protected` isolated calls need one
57 | # extra level of indentation.
58 | Layout/IndentationConsistency:
59 | Enabled: true
60 | EnforcedStyle: rails
61 |
62 | # Two spaces, no tabs (for indentation).
63 | Layout/IndentationWidth:
64 | Enabled: true
65 |
66 | Layout/LeadingCommentSpace:
67 | Enabled: true
68 |
69 | Layout/SpaceAfterColon:
70 | Enabled: true
71 |
72 | Layout/SpaceAfterComma:
73 | Enabled: true
74 |
75 | Layout/SpaceAroundEqualsInParameterDefault:
76 | Enabled: true
77 |
78 | Layout/SpaceAroundKeyword:
79 | Enabled: true
80 |
81 | Layout/SpaceAroundOperators:
82 | Enabled: true
83 |
84 | Layout/SpaceBeforeComma:
85 | Enabled: true
86 |
87 | Layout/SpaceBeforeFirstArg:
88 | Enabled: true
89 |
90 | Style/DefWithParentheses:
91 | Enabled: true
92 |
93 | # Defining a method with parameters needs parentheses.
94 | Style/MethodDefParentheses:
95 | Enabled: true
96 |
97 | Style/FrozenStringLiteralComment:
98 | Enabled: false
99 | EnforcedStyle: always
100 |
101 | # Use `foo {}` not `foo{}`.
102 | Layout/SpaceBeforeBlockBraces:
103 | Enabled: true
104 |
105 | # Use `foo { bar }` not `foo {bar}`.
106 | Layout/SpaceInsideBlockBraces:
107 | Enabled: true
108 |
109 | # Use `{ a: 1 }` not `{a:1}`.
110 | Layout/SpaceInsideHashLiteralBraces:
111 | Enabled: true
112 |
113 | Layout/SpaceInsideParens:
114 | Enabled: true
115 |
116 | # Check quotes usage according to lint rule below.
117 | #Style/StringLiterals:
118 | # Enabled: true
119 | # EnforcedStyle: single_quotes
120 |
121 | # Detect hard tabs, no hard tabs.
122 | Layout/Tab:
123 | Enabled: true
124 |
125 | # Blank lines should not have any spaces.
126 | Layout/TrailingBlankLines:
127 | Enabled: true
128 |
129 | # No trailing whitespace.
130 | Layout/TrailingWhitespace:
131 | Enabled: false
132 |
133 | # Use quotes for string literals when they are enough.
134 | Style/UnneededPercentQ:
135 | Enabled: true
136 |
137 | # Align `end` with the matching keyword or starting expression except for
138 | # assignments, where it should be aligned with the LHS.
139 | Lint/EndAlignment:
140 | Enabled: true
141 | EnforcedStyleAlignWith: variable
142 | AutoCorrect: true
143 |
144 | # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
145 | Lint/RequireParentheses:
146 | Enabled: true
147 |
148 | Style/RedundantReturn:
149 | Enabled: true
150 | AllowMultipleReturnValues: true
151 |
152 | Style/Semicolon:
153 | Enabled: true
154 | AllowAsExpressionSeparator: true
155 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## Transactional
4 |
5 | ### 1.0.56
6 | * Adding DMARC and DKIM2 fields to the API reference
7 |
8 | ### 1.0.55
9 | * Updating github actions bot user email
10 |
11 | ### 1.0.54
12 | * Fixing a problem with Github auth token that was preventing builds from being created.
13 |
14 | ### 1.0.53
15 | * Fixed broken ruby SDK test, updated PHP SDK to send form data via JSON
16 |
17 | ### 1.0.52
18 | * Added the `is_broken_template` response to the /template endpoints that include it
19 |
20 | ### 1.0.51
21 | * Fixed `/messages/send-template` documentation where incorrectly referenced the template name usage.
22 |
23 | ### 1.0.50
24 | * Added a response parameter to /messages/send and /messages/send-template called 'queued_response' that details why an email was queued.
25 |
26 | ### 1.0.48
27 | * Allowing users to schedule messages (using messages/send, messages/send-template, messages/send-raw and messages/reschedule APIs) within a year from the date of scheduling.
28 |
29 | ### 1.0.46
30 | * Added a little more granularity to the `set_timeout` method to the Client class in the Ruby SDK; now supports `read`, `write` and `connect` parameters, which will default to the `timeout` param if unspecified, or 300 seconds if `timeout` is unspecified.
31 |
32 | ### 1.0.45
33 | * Added a `set_timeout` method to the Client class in the Ruby SDK
34 |
35 | ### 1.0.44
36 | * Added a `set_timeout` method to the Client class in the Python SDK
37 |
38 | ### 1.0.43
39 | * Added a `setTimeout` method to the Configuration class in the PHP SDK.
40 |
41 | ### 1.0.42
42 | * Added a `setDefaultTimeoutMs` method to the node client. This allows users to override the default timeout for API requests, which is set to 5 minutes by default.
43 |
44 | ### 1.0.41
45 | * Updated the "reject_reasons" response for /messages/send and /messages/send-template to correctly use "hard-bounce" and "soft-bounce" instead of the previously stated "hard_bounce" and "soft_bounce".
46 |
47 | ### 1.0.40
48 | * Added the new /allowlists/ series of endpoints and the /exports/allowlist endpoint to the API reference
49 |
50 | ### 1.0.39
51 | * Fixes the output directory for the Changelog for the php client library
52 |
53 | ### 1.0.38
54 | * A change was made to `mailchimp-transactional-php` - the API client will now always return an `Exception`, instead of an `Exception` or a string, when the API returns an error. Having to parse the response as a string was found to be a bit clunky.
55 |
56 | ### 1.0.37
57 | * Added a changelog, which will be used to describe changes to both transactional and marketing client libraries.
58 |
59 | ## Marketing
60 |
61 | ### 3.0.72
62 | * Updated the `PATCH /automations/.../emails/.../` documentation to state the required `workflow_type`
63 |
64 | ### 3.0.70
65 | * Added more granularity for the `timeout` field in the Ruby Marketing SDK; now supports `read_timeout`, `write_timeout` and `connect_timeout` fields which will default to the `timeout` value.
66 |
67 | ### 3.0.69
68 | * Added handling for a `timeout` field in the config block passed to the client constructor in the Ruby Marketing SDK.
69 |
70 | ### 3.0.68
71 | * Added handling for a `'timeout'` field in `set_config()` in the Python Marketing SDK.
72 |
73 | ### 3.0.67
74 | * Added a `setTimeout()` method to the configuration class in the PHP Marketing SDK, to allow manually setting the timeout for Guzzle requests.
75 |
76 | ### 3.0.65
77 | * Added a new API endpoint, `/3.0/account-exports`, allowing users to programatically export their account information
78 |
79 | ### 3.0.64
80 | * Fixes the output directory for the Changelog for the php client library
81 |
82 | ### 3.0.63
83 | * Added a changelog, which will be used to describe changes to both transactional and marketing client libraries.
84 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | gemspec
4 |
5 | group :development, :test do
6 | gem 'rake', '~> 12.3.3'
7 | end
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Mailchimp Client Library License Agreement
2 |
3 | IMPORTANT- PLEASE READ CAREFULLY BEFORE OPENING, INSTALLING, COPYING OR USING THE CLIENT LIBRARY. This Client Library License Agreement (“Agreement”) is a legal document by and between you (hereinafter referred to as “You” “Your” or “Licensee”) and The Rocket Science Group LLC (“Mailchimp”) (each a “Party” and collectively, “Parties”) for the client library, including any upgrades, modified versions, updates, additions, and copies of the foregoing, including the software and related documentation (the “Mailchimp Client Library”).
4 |
5 | BY OPENING, INSTALLING, COPYING OR USING THE MAILCHIMP CLIENT LIBRARY OR ANY PORTION THEREOF, YOU AGREE TO ALL THE TERMS OF THIS AGREEMENT. IF YOU ARE AGREEING TO THIS AGREEMENT AS AN INDIVIDUAL, “YOU” “YOUR” AND “LICENSEE” REFERS TO YOU INDIVIDUALLY. IF YOU ARE AGREEING TO THIS AGREEMENT AS A REPRESENTATIVE OF A LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE AUTHORITY TO BIND THAT ENTITY AND “YOU” “YOUR” AND “LICENSEE” REFERS TO THAT LEGAL ENTITY AND ALL THE USERS ACCESSING THE SOFTWARE BY, THROUGH OR ON BEHALF OF THAT LEGAL ENTITY. IF YOU DO NOT AGREE WITH ALL OF THE TERMS OF THIS AGREEMENT, DO NOT (AND ENSURE THAT YOUR END USERS DO NOT) OPEN, INSTALL, COPY OR USE THE MAILCHIMP CLIENT LIBRARY.
6 |
7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | 1. Definitions.
9 | “License” shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 10 of these Terms and Conditions for Use, Reproduction and Distribution.
10 | “Legal Entity” shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, “control” means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
11 | “You” (or “Your”) shall mean an individual or Legal Entity exercising permissions granted by this License.
12 | “Source” form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
13 | “Object” form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
14 | “Work” shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
15 | “Derivative Works” shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
16 | “Contribution” shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Mailchimp for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to Mailchimp or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Mailchimp for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as “Not a Contribution.”
17 | “Contributor” shall mean Mailchimp and any individual or Legal Entity on behalf of whom a Contribution has been received by Mailchimp and subsequently incorporated within the Work.
18 |
19 | 2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
20 |
21 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
22 |
23 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
24 | a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
25 | b) You must cause any modified files to carry prominent notices stating that You changed the files; and
26 | c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
27 | d) If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
28 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
29 |
30 | 5. Submission of Contributions. Any Contribution submitted for inclusion in the Work by You to Mailchimp shall be made under the terms and conditions of the Individual Contributor License Agreement or the Software Grant and Corporate Contributor License Agreement, as applicable.
31 |
32 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of Mailchimp, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
33 |
34 | 7. Export controls. The Mailchimp Client Library is subject to united states export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the Mailchimp Client Library. These laws include restrictions on destinations, end-users and end use.
35 |
36 | 8. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
37 |
38 | 9. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
39 |
40 | 10. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
41 |
42 | Copyright 2020, The Rocket Science Group LLC
43 |
44 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
45 |
46 | You should include a copy of the License, typically in a file called LICENSE, in your work, and consider also including a NOTICE file.
47 |
48 | To apply the License to specific files in your work, attach the following boilerplate declaration, with the fields enclosed by brackets “[]” replaced with your own identifying information. (Don’t include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same “printed page” as the copyright notice for easier identification within third-party archives.
49 | Copyright [yyyy] [name of copyright owner]
50 |
51 | Licensed under the Mailchimp Client Library License Agreement (the “License”); you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either or express or implied.
52 | See the License for the specific language governing permissions and
53 | limitations under the License.
54 |
--------------------------------------------------------------------------------
/MailchimpTransactional.gemspec:
--------------------------------------------------------------------------------
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.59
9 | Contact: apihelp@mailchimp.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 = ["Mailchimp"]
23 | s.email = ["apihelp@mailchimp.com"]
24 | s.homepage = "https://github.com/mailchimp/mailchimp-client-lib-codegen"
25 | s.summary = "Mailchimp Transactional API Ruby Gem"
26 | s.description = "The official Ruby client library for the Mailchimp Trainsactional API"
27 | s.license = 'Apache-2.0'
28 | s.required_ruby_version = ">= 1.9"
29 |
30 | s.add_runtime_dependency 'excon', '>= 0.76.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 = []
43 | s.executables = []
44 | s.require_paths = ["lib"]
45 | end
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | # Mailchimp Transactional — Ruby
8 |
9 | The official Ruby client library for the Mailchimp Transactional API (v1)
10 |
11 | ## Installation
12 |
13 | ### Build a gem
14 |
15 | To build the Ruby code into a gem:
16 |
17 | ```shell
18 | gem build MailchimpTransactional.gemspec
19 | ```
20 |
21 | Then either install the gem locally:
22 |
23 | ```shell
24 | gem install ./MailchimpTransactional-1.0.59.gem
25 | ```
26 | (for development, run `gem install --dev ./MailchimpTransactional-1.0.59.gem` to install the development dependencies)
27 |
28 | or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
29 |
30 | Finally add this to the Gemfile:
31 |
32 | gem 'MailchimpTransactional', '~> 1.0.59'
33 |
34 | ### Install from Git
35 |
36 | If the Ruby gem is hosted at a git repository: https://github.com/mailchimp/mailchimp-transactional-ruby, then add the following in the Gemfile:
37 |
38 | gem 'MailchimpTransactional', :git => 'https://github.com/mailchimp/mailchimp-transactional-ruby.git'
39 |
40 | ### Include the Ruby code directly
41 |
42 | Include the Ruby code directly using `-I` as follows:
43 |
44 | ```shell
45 | ruby -Ilib script.rb
46 | ```
47 |
48 | ## Quick Start
49 |
50 | ```ruby
51 | require 'MailchimpTransactional'
52 |
53 | begin
54 | client = MailchimpTransactional::Client.new('YOUR_API_KEY')
55 | resp = client.users.ping
56 | p resp
57 | rescue MailchimpTransactional::ApiError => e
58 | puts "Error: #{e}"
59 | end
60 | ```
61 |
62 | ## Sending Requests
63 | All requests are sent via POST and accept a single argument as the request body parameter.
64 | ```ruby
65 | client.templates.publish({ name:'My Template' });
66 | ```
67 |
68 | ## Output Formats
69 | Optionally, you can set the default response format for **all requests** to one of the following:
70 | - `json` *(default)*
71 | - `xml`
72 | - `php`
73 | - `yaml`
74 |
75 | ```ruby
76 | client.set_default_output_format('xml');
77 | ```
78 |
79 | You can also set the response format for a **single request** by passing in a special `outputFormat` param to the request body.
80 | ```ruby
81 | client.senders.list({ outputFormat: 'php' });
82 | ```
83 |
84 | ## PRs and Issues
85 | This repo is autogenerated from https://github.com/mailchimp/mailchimp-client-lib-codegen -- please submit PRs or issues there!
86 |
87 | ## API Endpoints
88 |
89 | All URIs are relative to *https://mandrillapp.com/api/1.0*
90 |
91 | | Method | Endpoint |
92 | | ---------- | -------- |
93 | | **allowlists.add** | /allowlists/add |
94 | | **allowlists.delete** | /allowlists/delete |
95 | | **allowlists.list** | /allowlists/list |
96 | | **exports.activity** | /exports/activity |
97 | | **exports.allowlist** | /exports/allowlist |
98 | | **exports.info** | /exports/info |
99 | | **exports.list** | /exports/list |
100 | | **exports.rejects** | /exports/rejects |
101 | | **exports.whitelist** | /exports/whitelist |
102 | | **inbound.add_domain** | /inbound/add-domain |
103 | | **inbound.add_route** | /inbound/add-route |
104 | | **inbound.check_domain** | /inbound/check-domain |
105 | | **inbound.delete_domain** | /inbound/delete-domain |
106 | | **inbound.delete_route** | /inbound/delete-route |
107 | | **inbound.domains** | /inbound/domains |
108 | | **inbound.routes** | /inbound/routes |
109 | | **inbound.send_raw** | /inbound/send-raw |
110 | | **inbound.update_route** | /inbound/update-route |
111 | | **ips.cancel_warmup** | /ips/cancel-warmup |
112 | | **ips.check_custom_dns** | /ips/check-custom-dns |
113 | | **ips.create_pool** | /ips/create-pool |
114 | | **ips.delete** | /ips/delete |
115 | | **ips.delete_pool** | /ips/delete-pool |
116 | | **ips.info** | /ips/info |
117 | | **ips.list** | /ips/list |
118 | | **ips.list_pools** | /ips/list-pools |
119 | | **ips.pool_info** | /ips/pool-info |
120 | | **ips.provision** | /ips/provision |
121 | | **ips.set_custom_dns** | /ips/set-custom-dns |
122 | | **ips.set_pool** | /ips/set-pool |
123 | | **ips.start_warmup** | /ips/start-warmup |
124 | | **messages.cancel_scheduled** | /messages/cancel-scheduled |
125 | | **messages.content** | /messages/content |
126 | | **messages.info** | /messages/info |
127 | | **messages.list_scheduled** | /messages/list-scheduled |
128 | | **messages.parse** | /messages/parse |
129 | | **messages.reschedule** | /messages/reschedule |
130 | | **messages.search** | /messages/search |
131 | | **messages.search_time_series** | /messages/search-time-series |
132 | | **messages.send** | /messages/send |
133 | | **messages.send_raw** | /messages/send-raw |
134 | | **messages.send_template** | /messages/send-template |
135 | | **metadata.add** | /metadata/add |
136 | | **metadata.delete** | /metadata/delete |
137 | | **metadata.list** | /metadata/list |
138 | | **metadata.update** | /metadata/update |
139 | | **rejects.add** | /rejects/add |
140 | | **rejects.delete** | /rejects/delete |
141 | | **rejects.list** | /rejects/list |
142 | | **senders.add_domain** | /senders/add-domain |
143 | | **senders.check_domain** | /senders/check-domain |
144 | | **senders.domains** | /senders/domains |
145 | | **senders.info** | /senders/info |
146 | | **senders.list** | /senders/list |
147 | | **senders.time_series** | /senders/time-series |
148 | | **senders.verify_domain** | /senders/verify-domain |
149 | | **subaccounts.add** | /subaccounts/add |
150 | | **subaccounts.delete** | /subaccounts/delete |
151 | | **subaccounts.info** | /subaccounts/info |
152 | | **subaccounts.list** | /subaccounts/list |
153 | | **subaccounts.pause** | /subaccounts/pause |
154 | | **subaccounts.resume** | /subaccounts/resume |
155 | | **subaccounts.update** | /subaccounts/update |
156 | | **tags.all_time_series** | /tags/all-time-series |
157 | | **tags.delete** | /tags/delete |
158 | | **tags.info** | /tags/info |
159 | | **tags.list** | /tags/list |
160 | | **tags.time_series** | /tags/time-series |
161 | | **templates.add** | /templates/add |
162 | | **templates.delete** | /templates/delete |
163 | | **templates.info** | /templates/info |
164 | | **templates.list** | /templates/list |
165 | | **templates.publish** | /templates/publish |
166 | | **templates.render** | /templates/render |
167 | | **templates.time_series** | /templates/time-series |
168 | | **templates.update** | /templates/update |
169 | | **urls.add_tracking_domain** | /urls/add-tracking-domain |
170 | | **urls.check_tracking_domain** | /urls/check-tracking-domain |
171 | | **urls.list** | /urls/list |
172 | | **urls.search** | /urls/search |
173 | | **urls.time_series** | /urls/time-series |
174 | | **urls.tracking_domains** | /urls/tracking-domains |
175 | | **users.info** | /users/info |
176 | | **users.ping** | /users/ping |
177 | | **users.ping2** | /users/ping2 |
178 | | **users.senders** | /users/senders |
179 | | **webhooks.add** | /webhooks/add |
180 | | **webhooks.delete** | /webhooks/delete |
181 | | **webhooks.info** | /webhooks/info |
182 | | **webhooks.list** | /webhooks/list |
183 | | **webhooks.update** | /webhooks/update |
184 | | **whitelists.add** | /whitelists/add |
185 | | **whitelists.delete** | /whitelists/delete |
186 | | **whitelists.list** | /whitelists/list |
187 |
188 |
189 | ## Additional Libraries
190 |
191 | Mailchimp Transactional libraries are available in the following languages:
192 |
193 |
207 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 | # APIs
19 | require 'MailchimpTransactional/api/allowlists_api'
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 | set_api_key(api_key)
39 | end
40 |
41 | def set_api_key(api_key = '')
42 | @api_key = api_key
43 | @api_client = ApiClient.new(@api_key)
44 |
45 | @Allowlists = AllowlistsApi.new(@api_client)
46 | @Exports = ExportsApi.new(@api_client)
47 | @Inbound = InboundApi.new(@api_client)
48 | @Ips = IpsApi.new(@api_client)
49 | @Messages = MessagesApi.new(@api_client)
50 | @Metadata = MetadataApi.new(@api_client)
51 | @Rejects = RejectsApi.new(@api_client)
52 | @Senders = SendersApi.new(@api_client)
53 | @Subaccounts = SubaccountsApi.new(@api_client)
54 | @Tags = TagsApi.new(@api_client)
55 | @Templates = TemplatesApi.new(@api_client)
56 | @Urls = UrlsApi.new(@api_client)
57 | @Users = UsersApi.new(@api_client)
58 | @Webhooks = WebhooksApi.new(@api_client)
59 | @Whitelists = WhitelistsApi.new(@api_client)
60 | end
61 |
62 | def set_default_output_format(output_format)
63 | @api_client.set_default_output_format(output_format)
64 | end
65 |
66 | def set_timeout(timeout=nil, read: nil, write: nil, connect: nil)
67 | @api_client.set_timeout(timeout, read: read, write: write, connect: connect)
68 | end
69 |
70 | def allowlists
71 | @Allowlists
72 | end
73 | def exports
74 | @Exports
75 | end
76 | def inbound
77 | @Inbound
78 | end
79 | def ips
80 | @Ips
81 | end
82 | def messages
83 | @Messages
84 | end
85 | def metadata
86 | @Metadata
87 | end
88 | def rejects
89 | @Rejects
90 | end
91 | def senders
92 | @Senders
93 | end
94 | def subaccounts
95 | @Subaccounts
96 | end
97 | def tags
98 | @Tags
99 | end
100 | def templates
101 | @Templates
102 | end
103 | def urls
104 | @Urls
105 | end
106 | def users
107 | @Users
108 | end
109 | def webhooks
110 | @Webhooks
111 | end
112 | def whitelists
113 | @Whitelists
114 | end
115 | end
116 | end
117 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/allowlists_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 AllowlistsApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Add email to allowlist
24 | # Adds an email to your email rejection allowlist. If the address is currently on your denylist, that denylist entry will be removed automatically.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers
28 | def add(body = {})
29 | data = @api_client.call_api(:POST, '/allowlists/add', body)
30 | data
31 | end
32 |
33 | # Remove email from allowlist
34 | # Removes an email address from the allowlist.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse2002, Fixnum, Hash)>] InlineResponse2002 data, response status code and response headers
38 | def delete(body = {})
39 | data = @api_client.call_api(:POST, '/allowlists/delete', body)
40 | data
41 | end
42 |
43 | # List allowlisted emails
44 | # Retrieves your email rejection allowlist. You can provide an email address or search prefix to limit the results. Returns up to 1000 results.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
48 | def list(body = {})
49 | data = @api_client.call_api(:POST, '/allowlists/list', body)
50 | data
51 | end
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/exports_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Export activity history
24 | # 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.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse2007, Fixnum, Hash)>] InlineResponse2007 data, response status code and response headers
28 | def activity(body = {})
29 | data = @api_client.call_api(:POST, '/exports/activity', body)
30 | data
31 | end
32 |
33 | # Export Allowlist
34 | # Begins an export of your rejection allowlist. The allowlist will be exported to a zip archive containing a single file named allowlist.csv that includes the following fields: email, detail, created_at.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse2006, Fixnum, Hash)>] InlineResponse2006 data, response status code and response headers
38 | def allowlist(body = {})
39 | data = @api_client.call_api(:POST, '/exports/allowlist', body)
40 | data
41 | end
42 |
43 | # View export info
44 | # 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.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(InlineResponse2003, Fixnum, Hash)>] InlineResponse2003 data, response status code and response headers
48 | def info(body = {})
49 | data = @api_client.call_api(:POST, '/exports/info', body)
50 | data
51 | end
52 |
53 | # List exports
54 | # Returns a list of your exports.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
58 | def list(body = {})
59 | data = @api_client.call_api(:POST, '/exports/list', body)
60 | data
61 | end
62 |
63 | # Export denylist
64 | # Begins an export of your rejection denylist. The denylist 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.
65 | # @param body
66 | # @param [Hash] opts the optional parameters
67 | # @return [Array<(InlineResponse2005, Fixnum, Hash)>] InlineResponse2005 data, response status code and response headers
68 | def rejects(body = {})
69 | data = @api_client.call_api(:POST, '/exports/rejects', body)
70 | data
71 | end
72 |
73 | # Export Allowlist
74 | # Begins an export of your rejection allowlist. The allowlist will be exported to a zip archive containing a single file named allowlist.csv that includes the following fields: email, detail, created_at.
75 | # @param body
76 | # @param [Hash] opts the optional parameters
77 | # @return [Array<(InlineResponse2006, Fixnum, Hash)>] InlineResponse2006 data, response status code and response headers
78 | def whitelist(body = {})
79 | data = @api_client.call_api(:POST, '/exports/whitelist', body)
80 | data
81 | end
82 | end
83 | end
84 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/inbound_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 InboundApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Add inbound domain
24 | # Add an inbound domain to your account.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse2009, Fixnum, Hash)>] InlineResponse2009 data, response status code and response headers
28 | def add_domain(body = {})
29 | data = @api_client.call_api(:POST, '/inbound/add-domain', body)
30 | data
31 | end
32 |
33 | # Add mailbox route
34 | # Add a new mailbox route to an inbound domain.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse20013, Fixnum, Hash)>] InlineResponse20013 data, response status code and response headers
38 | def add_route(body = {})
39 | data = @api_client.call_api(:POST, '/inbound/add-route', body)
40 | data
41 | end
42 |
43 | # Check domain settings
44 | # Check the MX settings for an inbound domain. The domain must have already been added with the add-domain call.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(InlineResponse20010, Fixnum, Hash)>] InlineResponse20010 data, response status code and response headers
48 | def check_domain(body = {})
49 | data = @api_client.call_api(:POST, '/inbound/check-domain', body)
50 | data
51 | end
52 |
53 | # Delete inbound domain
54 | # Delete an inbound domain from the account. All mail will stop routing for this domain immediately.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(InlineResponse20011, Fixnum, Hash)>] InlineResponse20011 data, response status code and response headers
58 | def delete_domain(body = {})
59 | data = @api_client.call_api(:POST, '/inbound/delete-domain', body)
60 | data
61 | end
62 |
63 | # Delete mailbox route
64 | # Delete an existing inbound mailbox route.
65 | # @param body
66 | # @param [Hash] opts the optional parameters
67 | # @return [Array<(InlineResponse20015, Fixnum, Hash)>] InlineResponse20015 data, response status code and response headers
68 | def delete_route(body = {})
69 | data = @api_client.call_api(:POST, '/inbound/delete-route', body)
70 | data
71 | end
72 |
73 | # List inbound domains
74 | # List the domains that have been configured for inbound delivery.
75 | # @param body
76 | # @param [Hash] opts the optional parameters
77 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
78 | def domains(body = {})
79 | data = @api_client.call_api(:POST, '/inbound/domains', body)
80 | data
81 | end
82 |
83 | # List mailbox routes
84 | # List the mailbox routes defined for an inbound domain.
85 | # @param body
86 | # @param [Hash] opts the optional parameters
87 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
88 | def routes(body = {})
89 | data = @api_client.call_api(:POST, '/inbound/routes', body)
90 | data
91 | end
92 |
93 | # Send mime document
94 | # Take a raw MIME document destined for a domain with inbound domains set up, and send it to the inbound hook exactly as if it had been sent over SMTP.
95 | # @param body
96 | # @param [Hash] opts the optional parameters
97 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
98 | def send_raw(body = {})
99 | data = @api_client.call_api(:POST, '/inbound/send-raw', body)
100 | data
101 | end
102 |
103 | # Update mailbox route
104 | # Update the pattern or webhook of an existing inbound mailbox route. If null is provided for any fields, the values will remain unchanged.
105 | # @param body
106 | # @param [Hash] opts the optional parameters
107 | # @return [Array<(InlineResponse20014, Fixnum, Hash)>] InlineResponse20014 data, response status code and response headers
108 | def update_route(body = {})
109 | data = @api_client.call_api(:POST, '/inbound/update-route', body)
110 | data
111 | end
112 | end
113 | end
114 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/ips_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 IpsApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Cancel ip warmup
24 | # Cancels the warmup process for a dedicated IP.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse20020, Fixnum, Hash)>] InlineResponse20020 data, response status code and response headers
28 | def cancel_warmup(body = {})
29 | data = @api_client.call_api(:POST, '/ips/cancel-warmup', body)
30 | data
31 | end
32 |
33 | # Test custom dns
34 | # Tests whether a domain name is valid for use as the custom reverse DNS for a dedicated IP.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse20026, Fixnum, Hash)>] InlineResponse20026 data, response status code and response headers
38 | def check_custom_dns(body = {})
39 | data = @api_client.call_api(:POST, '/ips/check-custom-dns', body)
40 | data
41 | end
42 |
43 | # Add ip pool
44 | # Creates a pool and returns it. If a pool already exists with this name, no action will be performed.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(InlineResponse20024, Fixnum, Hash)>] InlineResponse20024 data, response status code and response headers
48 | def create_pool(body = {})
49 | data = @api_client.call_api(:POST, '/ips/create-pool', body)
50 | data
51 | end
52 |
53 | # Delete ip address
54 | # Deletes a dedicated IP. This is permanent and cannot be undone.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(InlineResponse20022, Fixnum, Hash)>] InlineResponse20022 data, response status code and response headers
58 | def delete(body = {})
59 | data = @api_client.call_api(:POST, '/ips/delete', body)
60 | data
61 | end
62 |
63 | # Delete ip pool
64 | # Deletes a pool. A pool must be empty before you can delete it, and you cannot delete your default pool.
65 | # @param body
66 | # @param [Hash] opts the optional parameters
67 | # @return [Array<(InlineResponse20025, Fixnum, Hash)>] InlineResponse20025 data, response status code and response headers
68 | def delete_pool(body = {})
69 | data = @api_client.call_api(:POST, '/ips/delete-pool', body)
70 | data
71 | end
72 |
73 | # Get ip info
74 | # Retrieves information about a single dedicated IP.
75 | # @param body
76 | # @param [Hash] opts the optional parameters
77 | # @return [Array<(InlineResponse20018, Fixnum, Hash)>] InlineResponse20018 data, response status code and response headers
78 | def info(body = {})
79 | data = @api_client.call_api(:POST, '/ips/info', body)
80 | data
81 | end
82 |
83 | # List ip addresses
84 | # Lists your dedicated IPs.
85 | # @param body
86 | # @param [Hash] opts the optional parameters
87 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
88 | def list(body = {})
89 | data = @api_client.call_api(:POST, '/ips/list', body)
90 | data
91 | end
92 |
93 | # List ip pools
94 | # Lists your dedicated IP pools.
95 | # @param body
96 | # @param [Hash] opts the optional parameters
97 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
98 | def list_pools(body = {})
99 | data = @api_client.call_api(:POST, '/ips/list-pools', body)
100 | data
101 | end
102 |
103 | # Get ip pool info
104 | # Describes a single dedicated IP pool.
105 | # @param body
106 | # @param [Hash] opts the optional parameters
107 | # @return [Array<(InlineResponse20024, Fixnum, Hash)>] InlineResponse20024 data, response status code and response headers
108 | def pool_info(body = {})
109 | data = @api_client.call_api(:POST, '/ips/pool-info', body)
110 | data
111 | end
112 |
113 | # Request additional ip
114 | # Requests an additional dedicated IP for your account. Accounts may have one outstanding request at any time, and provisioning requests are processed within 24 hours.
115 | # @param body
116 | # @param [Hash] opts the optional parameters
117 | # @return [Array<(InlineResponse20019, Fixnum, Hash)>] InlineResponse20019 data, response status code and response headers
118 | def provision(body = {})
119 | data = @api_client.call_api(:POST, '/ips/provision', body)
120 | data
121 | end
122 |
123 | # Set custom dns
124 | # Configures the custom DNS name for a dedicated IP.
125 | # @param body
126 | # @param [Hash] opts the optional parameters
127 | # @return [Array<(InlineResponse20027, Fixnum, Hash)>] InlineResponse20027 data, response status code and response headers
128 | def set_custom_dns(body = {})
129 | data = @api_client.call_api(:POST, '/ips/set-custom-dns', body)
130 | data
131 | end
132 |
133 | # Move ip to different pool
134 | # Moves a dedicated IP to a different pool.
135 | # @param body
136 | # @param [Hash] opts the optional parameters
137 | # @return [Array<(InlineResponse20021, Fixnum, Hash)>] InlineResponse20021 data, response status code and response headers
138 | def set_pool(body = {})
139 | data = @api_client.call_api(:POST, '/ips/set-pool', body)
140 | data
141 | end
142 |
143 | # Start ip warmup
144 | # Begins the warmup process for a dedicated IP. During the warmup process, the Transactional API will gradually increase the percentage of your mail that is sent over the warming-up IP, over a period of roughly 30 days. The rest of your mail will be sent over shared IPs or other dedicated IPs in the same pool.
145 | # @param body
146 | # @param [Hash] opts the optional parameters
147 | # @return [Array<(InlineResponse20020, Fixnum, Hash)>] InlineResponse20020 data, response status code and response headers
148 | def start_warmup(body = {})
149 | data = @api_client.call_api(:POST, '/ips/start-warmup', body)
150 | data
151 | end
152 | end
153 | end
154 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/messages_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 MessagesApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Cancel scheduled email
24 | # Cancels a scheduled email.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
28 | def cancel_scheduled(body = {})
29 | data = @api_client.call_api(:POST, '/messages/cancel-scheduled', body)
30 | data
31 | end
32 |
33 | # Get message content
34 | # Get the full content of a recently sent message.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse20033, Fixnum, Hash)>] InlineResponse20033 data, response status code and response headers
38 | def content(body = {})
39 | data = @api_client.call_api(:POST, '/messages/content', body)
40 | data
41 | end
42 |
43 | # Get message info
44 | # Get the information for a single recently sent message.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(InlineResponse20032, Fixnum, Hash)>] InlineResponse20032 data, response status code and response headers
48 | def info(body = {})
49 | data = @api_client.call_api(:POST, '/messages/info', body)
50 | data
51 | end
52 |
53 | # List scheduled emails
54 | # Queries your scheduled emails.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
58 | def list_scheduled(body = {})
59 | data = @api_client.call_api(:POST, '/messages/list-scheduled', body)
60 | data
61 | end
62 |
63 | # Parse mime document
64 | # Parse the full MIME document for an email message, returning the content of the message broken into its constituent pieces.
65 | # @param body
66 | # @param [Hash] opts the optional parameters
67 | # @return [Array<(InlineResponse20034, Fixnum, Hash)>] InlineResponse20034 data, response status code and response headers
68 | def parse(body = {})
69 | data = @api_client.call_api(:POST, '/messages/parse', body)
70 | data
71 | end
72 |
73 | # Reschedule email
74 | # Reschedules a scheduled email.
75 | # @param body
76 | # @param [Hash] opts the optional parameters
77 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
78 | def reschedule(body = {})
79 | data = @api_client.call_api(:POST, '/messages/reschedule', body)
80 | data
81 | end
82 |
83 | # Search messages by date
84 | # Search recently sent messages and optionally narrow by date range, tags, senders, and API keys. If no date range is specified, results within the last 7 days are returned. This method may be called up to 20 times per minute. If you need the data more often, you can use /messages/info.json to get the information for a single message, or webhooks to push activity to your own application for querying.
85 | # @param body
86 | # @param [Hash] opts the optional parameters
87 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
88 | def search(body = {})
89 | data = @api_client.call_api(:POST, '/messages/search', body)
90 | data
91 | end
92 |
93 | # Search messages by hour
94 | # Search the content of recently sent messages and return the aggregated hourly stats for matching messages.
95 | # @param body
96 | # @param [Hash] opts the optional parameters
97 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
98 | def search_time_series(body = {})
99 | data = @api_client.call_api(:POST, '/messages/search-time-series', body)
100 | data
101 | end
102 |
103 | # Send new message
104 | # Send a new transactional message through the Transactional API.
105 | # @param body
106 | # @param [Hash] opts the optional parameters
107 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
108 | def send(body = {})
109 | data = @api_client.call_api(:POST, '/messages/send', body)
110 | data
111 | end
112 |
113 | # Send mime document
114 | # Take a raw MIME document for a message, and send it exactly as if it were sent through the Transactional API's SMTP servers.
115 | # @param body
116 | # @param [Hash] opts the optional parameters
117 | # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
118 | def send_raw(body = {})
119 | data = @api_client.call_api(:POST, '/messages/send-raw', body)
120 | data
121 | end
122 |
123 | # Send using message template
124 | # Send a new transactional message through the Transactional API using a template.
125 | # @param body
126 | # @param [Hash] opts the optional parameters
127 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
128 | def send_template(body = {})
129 | data = @api_client.call_api(:POST, '/messages/send-template', body)
130 | data
131 | end
132 | end
133 | end
134 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/metadata_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 MetadataApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Add metadata field
24 | # Add a new custom metadata field to be indexed for the account.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse20037, Fixnum, Hash)>] InlineResponse20037 data, response status code and response headers
28 | def add(body = {})
29 | data = @api_client.call_api(:POST, '/metadata/add', body)
30 | data
31 | end
32 |
33 | # Delete metadata field
34 | # Delete an existing custom metadata field. Deletion isn't instataneous, and /metadata/list will continue to return the field until the asynchronous deletion process is complete.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse20039, Fixnum, Hash)>] InlineResponse20039 data, response status code and response headers
38 | def delete(body = {})
39 | data = @api_client.call_api(:POST, '/metadata/delete', body)
40 | data
41 | end
42 |
43 | # List metadata fields
44 | # Get the list of custom metadata fields indexed for the account.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
48 | def list(body = {})
49 | data = @api_client.call_api(:POST, '/metadata/list', body)
50 | data
51 | end
52 |
53 | # Update metadata field
54 | # Update an existing custom metadata field.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(InlineResponse20038, Fixnum, Hash)>] InlineResponse20038 data, response status code and response headers
58 | def update(body = {})
59 | data = @api_client.call_api(:POST, '/metadata/update', body)
60 | data
61 | end
62 | end
63 | end
64 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/rejects_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 RejectsApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Add email to denylist
24 | # Adds an email to your email rejection denylist. Addresses that you add manually will never expire and there is no reputation penalty for removing them from your denylist. Attempting to denylist an address that has been added to the allowlist will have no effect.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse20040, Fixnum, Hash)>] InlineResponse20040 data, response status code and response headers
28 | def add(body = {})
29 | data = @api_client.call_api(:POST, '/rejects/add', body)
30 | data
31 | end
32 |
33 | # Delete email from denylist
34 | # Deletes an email rejection. There is no limit to how many rejections you can remove from your denylist, but keep in mind that each deletion has an affect on your reputation.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse20042, Fixnum, Hash)>] InlineResponse20042 data, response status code and response headers
38 | def delete(body = {})
39 | data = @api_client.call_api(:POST, '/rejects/delete', body)
40 | data
41 | end
42 |
43 | # List denylisted emails
44 | # Retrieves your email rejection denylist. You can provide an email address to limit the results. Returns up to 1000 results. By default, entries that have expired are excluded from the results; set include_expired to true to include them.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
48 | def list(body = {})
49 | data = @api_client.call_api(:POST, '/rejects/list', body)
50 | data
51 | end
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/senders_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 SendersApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Add sender domain
24 | # Adds a sender domain to your account. Sender domains are added automatically as you send, but you can use this call to add them ahead of time.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse20045, Fixnum, Hash)>] InlineResponse20045 data, response status code and response headers
28 | def add_domain(body = {})
29 | data = @api_client.call_api(:POST, '/senders/add-domain', body)
30 | data
31 | end
32 |
33 | # Check domain settings
34 | # Checks the SPF and DKIM settings for a domain, as well the domain verification. If you haven't already added this domain to your account, it will be added automatically.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse20046, Fixnum, Hash)>] InlineResponse20046 data, response status code and response headers
38 | def check_domain(body = {})
39 | data = @api_client.call_api(:POST, '/senders/check-domain', body)
40 | data
41 | end
42 |
43 | # List sender domains
44 | # Returns the sender domains that have been added to this account.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
48 | def domains(body = {})
49 | data = @api_client.call_api(:POST, '/senders/domains', body)
50 | data
51 | end
52 |
53 | # Get sender info
54 | # Return more detailed information about a single sender, including aggregates of recent stats.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(InlineResponse20048, Fixnum, Hash)>] InlineResponse20048 data, response status code and response headers
58 | def info(body = {})
59 | data = @api_client.call_api(:POST, '/senders/info', body)
60 | data
61 | end
62 |
63 | # List account senders
64 | # Return the senders that have tried to use this account.
65 | # @param body
66 | # @param [Hash] opts the optional parameters
67 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
68 | def list(body = {})
69 | data = @api_client.call_api(:POST, '/senders/list', body)
70 | data
71 | end
72 |
73 | # View sender history
74 | # Return the recent history (hourly stats for the last 30 days) for a sender.
75 | # @param body
76 | # @param [Hash] opts the optional parameters
77 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
78 | def time_series(body = {})
79 | data = @api_client.call_api(:POST, '/senders/time-series', body)
80 | data
81 | end
82 |
83 | # Verify domain
84 | # Sends a verification email in order to verify ownership of a domain. Domain verification is a required step to confirm ownership of a domain. Once a domain has been verified in a Transactional API account, other accounts may not have their messages signed by that domain unless they also verify the domain. This prevents other Transactional API accounts from sending mail signed by your domain.
85 | # @param body
86 | # @param [Hash] opts the optional parameters
87 | # @return [Array<(InlineResponse20047, Fixnum, Hash)>] InlineResponse20047 data, response status code and response headers
88 | def verify_domain(body = {})
89 | data = @api_client.call_api(:POST, '/senders/verify-domain', body)
90 | data
91 | end
92 | end
93 | end
94 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/subaccounts_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 SubaccountsApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Add subaccount
24 | # Add a new subaccount.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse20051, Fixnum, Hash)>] InlineResponse20051 data, response status code and response headers
28 | def add(body = {})
29 | data = @api_client.call_api(:POST, '/subaccounts/add', body)
30 | data
31 | end
32 |
33 | # Delete subaccount
34 | # Delete an existing subaccount. Any email related to the subaccount will be saved, but stats will be removed and any future sending calls to this subaccount will fail.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse20054, Fixnum, Hash)>] InlineResponse20054 data, response status code and response headers
38 | def delete(body = {})
39 | data = @api_client.call_api(:POST, '/subaccounts/delete', body)
40 | data
41 | end
42 |
43 | # Get subaccount info
44 | # Given the ID of an existing subaccount, return the data about it.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(InlineResponse20052, Fixnum, Hash)>] InlineResponse20052 data, response status code and response headers
48 | def info(body = {})
49 | data = @api_client.call_api(:POST, '/subaccounts/info', body)
50 | data
51 | end
52 |
53 | # List subaccounts
54 | # Get the list of subaccounts defined for the account, optionally filtered by a prefix.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
58 | def list(body = {})
59 | data = @api_client.call_api(:POST, '/subaccounts/list', body)
60 | data
61 | end
62 |
63 | # Pause subaccount
64 | # Pause a subaccount's sending. Any future emails delivered to this subaccount will be queued for a maximum of 3 days until the subaccount is resumed.
65 | # @param body
66 | # @param [Hash] opts the optional parameters
67 | # @return [Array<(InlineResponse20055, Fixnum, Hash)>] InlineResponse20055 data, response status code and response headers
68 | def pause(body = {})
69 | data = @api_client.call_api(:POST, '/subaccounts/pause', body)
70 | data
71 | end
72 |
73 | # Resume subaccount
74 | # Resume a paused subaccount's sending.
75 | # @param body
76 | # @param [Hash] opts the optional parameters
77 | # @return [Array<(InlineResponse20056, Fixnum, Hash)>] InlineResponse20056 data, response status code and response headers
78 | def resume(body = {})
79 | data = @api_client.call_api(:POST, '/subaccounts/resume', body)
80 | data
81 | end
82 |
83 | # Update subaccount
84 | # Update an existing subaccount.
85 | # @param body
86 | # @param [Hash] opts the optional parameters
87 | # @return [Array<(InlineResponse20053, Fixnum, Hash)>] InlineResponse20053 data, response status code and response headers
88 | def update(body = {})
89 | data = @api_client.call_api(:POST, '/subaccounts/update', body)
90 | data
91 | end
92 | end
93 | end
94 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/tags_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 TagsApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # View all tags history
24 | # Return the recent history (hourly stats for the last 30 days) for all tags.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
28 | def all_time_series(body = {})
29 | data = @api_client.call_api(:POST, '/tags/all-time-series', body)
30 | data
31 | end
32 |
33 | # Delete tag
34 | # Deletes a tag permanently. Deleting a tag removes the tag from any messages that have been sent, and also deletes the tag's stats. There is no way to undo this operation, so use it carefully.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse20058, Fixnum, Hash)>] InlineResponse20058 data, response status code and response headers
38 | def delete(body = {})
39 | data = @api_client.call_api(:POST, '/tags/delete', body)
40 | data
41 | end
42 |
43 | # Get tag info
44 | # Return more detailed information about a single tag, including aggregates of recent stats.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(InlineResponse20059, Fixnum, Hash)>] InlineResponse20059 data, response status code and response headers
48 | def info(body = {})
49 | data = @api_client.call_api(:POST, '/tags/info', body)
50 | data
51 | end
52 |
53 | # List tags
54 | # Return all of the user-defined tag information.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
58 | def list(body = {})
59 | data = @api_client.call_api(:POST, '/tags/list', body)
60 | data
61 | end
62 |
63 | # View tag history
64 | # Return the recent history (hourly stats for the last 30 days) for a tag.
65 | # @param body
66 | # @param [Hash] opts the optional parameters
67 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
68 | def time_series(body = {})
69 | data = @api_client.call_api(:POST, '/tags/time-series', body)
70 | data
71 | end
72 | end
73 | end
74 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/templates_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 TemplatesApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Add template
24 | # Add a new template.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse20060, Fixnum, Hash)>] InlineResponse20060 data, response status code and response headers
28 | def add(body = {})
29 | data = @api_client.call_api(:POST, '/templates/add', body)
30 | data
31 | end
32 |
33 | # Delete template
34 | # Delete a template.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse20064, Fixnum, Hash)>] InlineResponse20064 data, response status code and response headers
38 | def delete(body = {})
39 | data = @api_client.call_api(:POST, '/templates/delete', body)
40 | data
41 | end
42 |
43 | # Get template info
44 | # Get the information for an existing template.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(InlineResponse20061, Fixnum, Hash)>] InlineResponse20061 data, response status code and response headers
48 | def info(body = {})
49 | data = @api_client.call_api(:POST, '/templates/info', body)
50 | data
51 | end
52 |
53 | # List templates
54 | # Return a list of all the templates available to this user.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
58 | def list(body = {})
59 | data = @api_client.call_api(:POST, '/templates/list', body)
60 | data
61 | end
62 |
63 | # Publish template content
64 | # Publish the content for the template. Any new messages sent using this template will start using the content that was previously in draft.
65 | # @param body
66 | # @param [Hash] opts the optional parameters
67 | # @return [Array<(InlineResponse20063, Fixnum, Hash)>] InlineResponse20063 data, response status code and response headers
68 | def publish(body = {})
69 | data = @api_client.call_api(:POST, '/templates/publish', body)
70 | data
71 | end
72 |
73 | # Render html template
74 | # Inject content and optionally merge fields into a template, returning the HTML that results.
75 | # @param body
76 | # @param [Hash] opts the optional parameters
77 | # @return [Array<(InlineResponse20066, Fixnum, Hash)>] InlineResponse20066 data, response status code and response headers
78 | def render(body = {})
79 | data = @api_client.call_api(:POST, '/templates/render', body)
80 | data
81 | end
82 |
83 | # Get template history
84 | # Return the recent history (hourly stats for the last 30 days) for a template.
85 | # @param body
86 | # @param [Hash] opts the optional parameters
87 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
88 | def time_series(body = {})
89 | data = @api_client.call_api(:POST, '/templates/time-series', body)
90 | data
91 | end
92 |
93 | # Update template
94 | # Update the code for an existing template. If null is provided for any fields, the values will remain unchanged.
95 | # @param body
96 | # @param [Hash] opts the optional parameters
97 | # @return [Array<(InlineResponse20062, Fixnum, Hash)>] InlineResponse20062 data, response status code and response headers
98 | def update(body = {})
99 | data = @api_client.call_api(:POST, '/templates/update', body)
100 | data
101 | end
102 | end
103 | end
104 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/urls_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 UrlsApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Add tracking domains
24 | # Add a tracking domain to your account.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse20071, Fixnum, Hash)>] InlineResponse20071 data, response status code and response headers
28 | def add_tracking_domain(body = {})
29 | data = @api_client.call_api(:POST, '/urls/add-tracking-domain', body)
30 | data
31 | end
32 |
33 | # Check cname settings
34 | # Checks the CNAME settings for a tracking domain. The domain must have been added already with the add-tracking-domain call.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse20071, Fixnum, Hash)>] InlineResponse20071 data, response status code and response headers
38 | def check_tracking_domain(body = {})
39 | data = @api_client.call_api(:POST, '/urls/check-tracking-domain', body)
40 | data
41 | end
42 |
43 | # List most clicked urls
44 | # Get the 100 most clicked URLs.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
48 | def list(body = {})
49 | data = @api_client.call_api(:POST, '/urls/list', body)
50 | data
51 | end
52 |
53 | # Search most clicked urls
54 | # Return the 100 most clicked URLs that match the search query given.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
58 | def search(body = {})
59 | data = @api_client.call_api(:POST, '/urls/search', body)
60 | data
61 | end
62 |
63 | # Get url history
64 | # Return the recent history (hourly stats for the last 30 days) for a URL
65 | # @param body
66 | # @param [Hash] opts the optional parameters
67 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
68 | def time_series(body = {})
69 | data = @api_client.call_api(:POST, '/urls/time-series', body)
70 | data
71 | end
72 |
73 | # List tracking domains
74 | # Get the list of tracking domains set up for this account.
75 | # @param body
76 | # @param [Hash] opts the optional parameters
77 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
78 | def tracking_domains(body = {})
79 | data = @api_client.call_api(:POST, '/urls/tracking-domains', body)
80 | data
81 | end
82 | end
83 | end
84 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/users_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 UsersApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Get user info
24 | # Return the information about the API-connected user.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse20072, Fixnum, Hash)>] InlineResponse20072 data, response status code and response headers
28 | def info(body = {})
29 | data = @api_client.call_api(:POST, '/users/info', body)
30 | data
31 | end
32 |
33 | # Ping
34 | # Validate an API key and respond to a ping.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
38 | def ping(body = {})
39 | data = @api_client.call_api(:POST, '/users/ping', body)
40 | data
41 | end
42 |
43 | # Ping 2
44 | # Validate an API key and respond to a ping (JSON parser version).
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(InlineResponse20073, Fixnum, Hash)>] InlineResponse20073 data, response status code and response headers
48 | def ping2(body = {})
49 | data = @api_client.call_api(:POST, '/users/ping2', body)
50 | data
51 | end
52 |
53 | # List account senders
54 | # Return the senders that have tried to use this account, both verified and unverified.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
58 | def senders(body = {})
59 | data = @api_client.call_api(:POST, '/users/senders', body)
60 | data
61 | end
62 | end
63 | end
64 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/webhooks_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 WebhooksApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Add webhook
24 | # Add a new webhook.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse20075, Fixnum, Hash)>] InlineResponse20075 data, response status code and response headers
28 | def add(body = {})
29 | data = @api_client.call_api(:POST, '/webhooks/add', body)
30 | data
31 | end
32 |
33 | # Delete webhook
34 | # Delete an existing webhook.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse20078, Fixnum, Hash)>] InlineResponse20078 data, response status code and response headers
38 | def delete(body = {})
39 | data = @api_client.call_api(:POST, '/webhooks/delete', body)
40 | data
41 | end
42 |
43 | # Get webhook info
44 | # Given the ID of an existing webhook, return the data about it.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(InlineResponse20076, Fixnum, Hash)>] InlineResponse20076 data, response status code and response headers
48 | def info(body = {})
49 | data = @api_client.call_api(:POST, '/webhooks/info', body)
50 | data
51 | end
52 |
53 | # List webhooks
54 | # Get the list of all webhooks defined on the account.
55 | # @param body
56 | # @param [Hash] opts the optional parameters
57 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
58 | def list(body = {})
59 | data = @api_client.call_api(:POST, '/webhooks/list', body)
60 | data
61 | end
62 |
63 | # Update webhook
64 | # Update an existing webhook.
65 | # @param body
66 | # @param [Hash] opts the optional parameters
67 | # @return [Array<(InlineResponse20077, Fixnum, Hash)>] InlineResponse20077 data, response status code and response headers
68 | def update(body = {})
69 | data = @api_client.call_api(:POST, '/webhooks/update', body)
70 | data
71 | end
72 | end
73 | end
74 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api/whitelists_api.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 WhitelistsApi
17 | attr_accessor :api_client
18 |
19 | def initialize(api_client = ApiClient.default)
20 | @api_client = api_client
21 | end
22 |
23 | # Add email to allowlist
24 | # Adds an email to your email rejection allowlist. If the address is currently on your denylist, that denylist entry will be removed automatically.
25 | # @param body
26 | # @param [Hash] opts the optional parameters
27 | # @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers
28 | def add(body = {})
29 | data = @api_client.call_api(:POST, '/whitelists/add', body)
30 | data
31 | end
32 |
33 | # Remove email from allowlist
34 | # Removes an email address from the allowlist.
35 | # @param body
36 | # @param [Hash] opts the optional parameters
37 | # @return [Array<(InlineResponse2002, Fixnum, Hash)>] InlineResponse2002 data, response status code and response headers
38 | def delete(body = {})
39 | data = @api_client.call_api(:POST, '/whitelists/delete', body)
40 | data
41 | end
42 |
43 | # List allowlisted emails
44 | # Retrieves your email rejection allowlist. You can provide an email address or search prefix to limit the results. Returns up to 1000 results.
45 | # @param body
46 | # @param [Hash] opts the optional parameters
47 | # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers
48 | def list(body = {})
49 | data = @api_client.call_api(:POST, '/whitelists/list', body)
50 | data
51 | end
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api_client.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 'json'
14 | require 'excon'
15 |
16 | module MailchimpTransactional
17 | class ApiClient
18 | def initialize(api_key = '')
19 | @host = "https://mandrillapp.com/api/1.0"
20 | @format_list = ['json', 'xml', 'php', 'yaml']
21 | @default_output_format = 'json'
22 | @accepts = ['application/json', 'application/xml', 'application/x-php', 'application/x-yaml; charset=utf-8']
23 | @read_timeout = 300
24 | @write_timeout = 300
25 | @connect_timeout = 300
26 | set_api_key(api_key)
27 | end
28 |
29 | def self.default
30 | @@default ||= ApiClient.new
31 | end
32 |
33 | def set_api_key(api_key = '')
34 | @api_key = api_key
35 | end
36 |
37 | def set_default_output_format(output_format)
38 | if @format_list.include? output_format
39 | @default_output_format = output_format
40 | end
41 | end
42 |
43 | def set_timeout(default_timeout=nil, read: nil, write: nil, connect: nil)
44 | default_timeout = default_timeout || 300
45 | @read_timeout = read || default_timeout
46 | @write_timeout = write || default_timeout
47 | @connect_timeout = connect || default_timeout
48 | end
49 |
50 | def call_api(http_method, path, body = {})
51 | use_default_output_format = true
52 | active_output_format = @default_output_format
53 | url = @host + path
54 |
55 | # format body
56 | if body[:outputFormat]
57 | format = body[:outputFormat].downcase
58 | if @format_list.include? format
59 | url += ".#{format}"
60 | body.delete(:outputFormat)
61 | use_default_output_format = false
62 | active_output_format = format
63 | end
64 | end
65 |
66 | # apply output format
67 | if use_default_output_format && @format_list.include?(@default_output_format)
68 | url += '.%s' % @default_output_format
69 | active_output_format = @default_output_format
70 | end
71 |
72 | # apply api key
73 | body[:key] = @api_key
74 |
75 | # send request
76 | conn = Excon.new(url, :headers => {'Content-Type' => 'application/json'}, :read_timeout => @read_timeout, :write_timeout => @write_timeout, :connect_timeout => @connect_timeout)
77 | res = conn.post(:body => body.to_json)
78 |
79 | # handle response
80 | data = nil
81 |
82 | if res.status == 200
83 | if active_output_format == 'json'
84 | data = JSON.parse(res.body)
85 | else
86 | data = res.body
87 | end
88 | end
89 |
90 | if (!data)
91 | fail ApiError.new(:status => res.status, :response_body => res.body)
92 | end
93 |
94 | return data
95 | end
96 | end
97 | end
98 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/api_error.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.com
8 | Generated by: https://github.com/swagger-api/swagger-codegen.git
9 | Swagger Codegen version: 2.4.12
10 |
11 | =end
12 |
13 | module MailchimpTransactional
14 | class ApiError < StandardError
15 | attr_reader :status, :type, :title, :detail, :instance, :errors,:response_headers, :response_body
16 |
17 | # Usage examples:
18 | # ApiError.new
19 | # ApiError.new("message")
20 | # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
21 | # ApiError.new(:code => 404, :message => "Not Found")
22 | def initialize(arg = nil)
23 | if arg.is_a? Hash
24 | if arg.key?(:message) || arg.key?('message')
25 | super(arg[:message] || arg['message'])
26 | else
27 | super arg
28 | end
29 |
30 | arg.each do |k, v|
31 | instance_variable_set "@#{k}", v
32 | end
33 | else
34 | super arg
35 | end
36 | end
37 | end
38 | end
39 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/configuration.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.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 Configuration
17 | # Defines url scheme
18 | attr_accessor :scheme
19 |
20 | # Defines url host
21 | attr_accessor :host
22 |
23 | # Defines url base path
24 | attr_accessor :base_path
25 |
26 | # Defines API keys used with API Key authentications.
27 | #
28 | # @return [Hash] key: parameter name, value: parameter value (API key)
29 | #
30 | # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
31 | # config.api_key['api_key'] = 'xxx'
32 | attr_accessor :api_key
33 |
34 | # Defines API key prefixes used with API Key authentications.
35 | #
36 | # @return [Hash] key: parameter name, value: API key prefix
37 | #
38 | # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
39 | # config.api_key_prefix['api_key'] = 'Token'
40 | attr_accessor :api_key_prefix
41 |
42 | # Defines the username used with HTTP basic authentication.
43 | #
44 | # @return [String]
45 | attr_accessor :username
46 |
47 | # Defines the password used with HTTP basic authentication.
48 | #
49 | # @return [String]
50 | attr_accessor :password
51 |
52 | # Defines the access token (Bearer) used with OAuth2.
53 | attr_accessor :access_token
54 |
55 | # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
56 | # details will be logged with `logger.debug` (see the `logger` attribute).
57 | # Default to false.
58 | #
59 | # @return [true, false]
60 | attr_accessor :debugging
61 |
62 | # Defines the logger used for debugging.
63 | # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
64 | #
65 | # @return [#debug]
66 | attr_accessor :logger
67 |
68 | # Defines the temporary folder to store downloaded files
69 | # (for API endpoints that have file response).
70 | # Default to use `Tempfile`.
71 | #
72 | # @return [String]
73 | attr_accessor :temp_folder_path
74 |
75 | # The time limit for HTTP request in seconds.
76 | # Default to 0 (never times out).
77 | attr_accessor :timeout
78 |
79 | # Set this to false to skip client side validation in the operation.
80 | # Default to true.
81 | # @return [true, false]
82 | attr_accessor :client_side_validation
83 |
84 | ### TLS/SSL setting
85 | # Set this to false to skip verifying SSL certificate when calling API from https server.
86 | # Default to true.
87 | #
88 | # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
89 | #
90 | # @return [true, false]
91 | attr_accessor :verify_ssl
92 |
93 | ### TLS/SSL setting
94 | # Set this to false to skip verifying SSL host name
95 | # Default to true.
96 | #
97 | # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
98 | #
99 | # @return [true, false]
100 | attr_accessor :verify_ssl_host
101 |
102 | ### TLS/SSL setting
103 | # Set this to customize the certificate file to verify the peer.
104 | #
105 | # @return [String] the path to the certificate file
106 | #
107 | # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
108 | # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
109 | attr_accessor :ssl_ca_cert
110 |
111 | ### TLS/SSL setting
112 | # Client certificate file (for client certificate)
113 | attr_accessor :cert_file
114 |
115 | ### TLS/SSL setting
116 | # Client private key file (for client certificate)
117 | attr_accessor :key_file
118 |
119 | # Set this to customize parameters encoding of array parameter with multi collectionFormat.
120 | # Default to nil.
121 | #
122 | # @see The params_encoding option of Ethon. Related source code:
123 | # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
124 | attr_accessor :params_encoding
125 |
126 | attr_accessor :inject_format
127 |
128 | attr_accessor :force_ending_format
129 |
130 | def initialize
131 | @scheme = 'https'
132 | @host = 'mandrillapp.com'
133 | @base_path = '/api/1.0'
134 | @api_key = {}
135 | @api_key_prefix = {}
136 | @timeout = 0
137 | @client_side_validation = true
138 | @verify_ssl = true
139 | @verify_ssl_host = true
140 | @params_encoding = nil
141 | @cert_file = nil
142 | @key_file = nil
143 | @debugging = false
144 | @inject_format = false
145 | @force_ending_format = false
146 | @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
147 |
148 | yield(self) if block_given?
149 | end
150 |
151 | # The default Configuration object.
152 | def self.default
153 | @@default ||= Configuration.new
154 | end
155 |
156 | def configure
157 | yield(self) if block_given?
158 | end
159 |
160 | def scheme=(scheme)
161 | # remove :// from scheme
162 | @scheme = scheme.sub(/:\/\//, '')
163 | end
164 |
165 | def host=(host)
166 | # remove http(s):// and anything after a slash
167 | @host = host.sub(/https?:\/\//, '').split('/').first
168 | end
169 |
170 | def base_path=(base_path)
171 | # Add leading and trailing slashes to base_path
172 | @base_path = "/#{base_path}".gsub(/\/+/, '/')
173 | @base_path = '' if @base_path == '/'
174 | end
175 |
176 | def base_url
177 | url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
178 | URI.encode(url)
179 | end
180 |
181 | # Gets API key (with prefix if set).
182 | # @param [String] param_name the parameter name of API key auth
183 | def api_key_with_prefix(param_name)
184 | if @api_key_prefix[param_name]
185 | "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
186 | else
187 | @api_key[param_name]
188 | end
189 | end
190 |
191 | # Gets Basic Auth token string
192 | def basic_auth_token
193 | 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
194 | end
195 |
196 | # Returns Auth Settings hash for api client.
197 | def auth_settings
198 | {
199 | }
200 | end
201 | end
202 | end
203 |
--------------------------------------------------------------------------------
/lib/MailchimpTransactional/version.rb:
--------------------------------------------------------------------------------
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.59
7 | Contact: apihelp@mailchimp.com
8 | Generated by: https://github.com/swagger-api/swagger-codegen.git
9 | Swagger Codegen version: 2.4.12
10 |
11 | =end
12 |
13 | module MailchimpTransactional
14 | VERSION = '1.0.59'
15 | end
16 |
--------------------------------------------------------------------------------