mailinator_client 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 020d864e0cc2093d379fb2e408c3f8920bd334f186a568616bfc25abbf3d5c54
4
- data.tar.gz: 5678100c51aa2a4590d3ae5b22cf745b1a5d7bb271863d698b9b0b0956417da0
3
+ metadata.gz: 9f84751a84c2f12dd32480148d28b58875645036b6e9ee37ec3b576f312c6344
4
+ data.tar.gz: bac6eaadc70a33e194df359bb2457f2e41583c04f210ab48ad0457cc8a44ada9
5
5
  SHA512:
6
- metadata.gz: d7d96ebfb16dd1d9e03c20b3a1b7b536bccc26df6c26c35cf3522f0f04f1c116b6db2fcd3f6b57a470ce7e2e23858c8792ddb3e309672413faeafdbf253b8f4f
7
- data.tar.gz: c36b73eaddb172d66f475158a2f89e6b548ca29239c4e0264a6549c489434ac61f8721a828e5fb1290a19e6e7212605fdb360dc7e822a2566662e2578c75eae3
6
+ metadata.gz: 913642bb4acca4b7a5ec4c0e7b06ddb3436e297bae4200bf884d9929423d692d40846f3deb3657dabf0aa0cacae59b7f9fdcbf32fd266a4b193c786b4c0446f9
7
+ data.tar.gz: d449cf69820f51a4c8721aed676da788b6b11336c70cb6017f7aee9681fa8758862a84fb528746957349000b637c3a14b7d37cc1e8855b2876d16bea8490061c
@@ -0,0 +1,23 @@
1
+ *~
2
+ \#*
3
+ .\#*
4
+ .DS_Store
5
+ *_flymake.*
6
+ *.LCK
7
+ .bundle
8
+ vendor/bundle
9
+ bin
10
+ *.gem
11
+ *.rbc
12
+ .bundle
13
+ .config
14
+ .yardoc
15
+ _yardoc
16
+ coverage
17
+ pkg
18
+ rdoc
19
+ spec/reports
20
+ test/tmp
21
+ test/version_tmp
22
+ tmp
23
+ Gemfile.lock
@@ -0,0 +1,11 @@
1
+ {
2
+ "default": true,
3
+ "MD009": { "br_spaces": 2 },
4
+ "MD013": false,
5
+ "MD033": false,
6
+ "MD041": false,
7
+ "MD007": { "indent": 4 },
8
+ "MD014": false,
9
+ "MD034": false,
10
+ "MD026": false
11
+ }
@@ -0,0 +1 @@
1
+ 2.5.3
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.5
4
+ - 2.4
5
+ - 2.3
6
+ - 2.2
7
+ - 2.1
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Manybrain, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,101 @@
1
+ # Mailinator Ruby REST API Client
2
+
3
+ [![Build Status](https://travis-ci.org/manybrain/mailinator-ruby-client.svg?branch=master)](https://travis-ci.org/manybrain/mailinator-ruby-client) [![Gem Version](https://badge.fury.io/rb/mailinator_client.svg)](https://badge.fury.io/rb/mailinator_client)
4
+
5
+ The [Mailinator](https://www.mailinator.com/) REST API client provides a simple way to use the comprehensive Mailinator API.
6
+
7
+ This client works with Ruby 2.1 and higher. It uses [HTTParty](https://github.com/jnunemaker/httparty) under the covers for the actual HTTP communication.
8
+
9
+ <br/>
10
+
11
+ ## Installation
12
+
13
+ The latest stable version is available in RubyGems and can be installed using
14
+
15
+ ```bash
16
+ gem install mailinator_client
17
+ ```
18
+
19
+ <br/>
20
+
21
+ ## API Documentation
22
+
23
+ ### MailinatorClient
24
+
25
+ MailinatorClient is the wrapping module, but it also acts as a singleton [Client](#mailinatorclient) instance. So if you only need a single client instance, you do not need to instantiate one yourself - the MailinatorClient module will act exactly like an instance of MailinatorClient::Client.
26
+
27
+ <br/>
28
+
29
+ ### MailinatorClient::Client
30
+
31
+ A client is a single api instance. By default, it is unauthenticated, but can be given an access token to perform authenticated requests.
32
+
33
+ #### Initializer
34
+
35
+ ```ruby
36
+ MailinatorClient::Client.new(auth_token: nil)
37
+ ```
38
+
39
+ The ``Client()`` initializer takes the following arguments:
40
+
41
+ * auth_token
42
+ The access token to be used for authentication - by default there is no access token.
43
+
44
+ #### Resources
45
+
46
+ Each of the following is a method on the client object, and returns a wrapper for the actions against that particular resource. See each resource documentation file for more information.
47
+
48
+ * [domains](docs/domains.md)
49
+ Contains all of the actions that can be performed against the set of [Domains](https://manybrain.github.io/m8rdocs/#domains-api) that the currently authenticated user has access to - such as listing the domains.
50
+
51
+ * [stats](docs/stats.md)
52
+ Contains all of the actions that can be performed against the set of [Stats](https://manybrain.github.io/m8rdocs/#stats-api) that the currently authenticated user has access to - such as listing the team stats.
53
+
54
+ * [rules](docs/rules.md)
55
+ Contains all of the actions that can be performed against the set of [Rules](https://manybrain.github.io/m8rdocs/#rules-api) that the currently authenticated user has access to - such as listing the rules or creating a new rule.
56
+
57
+ * [messages](docs/messages.md)
58
+ Contains all of the actions that can be performed against the set of [Messages](https://manybrain.github.io/m8rdocs/#message-api) that the currently authenticated user has access to - such as listing the messages or injecting a new message.
59
+
60
+ <br/>
61
+
62
+ ### MailinatorClient::ResponseError
63
+
64
+ When the Mailinator API returns a unsuccessful response, an instance of ResponseError is thrown.
65
+
66
+ #### ResponseError Accessors
67
+
68
+ * code
69
+ The status code returned from the Mailinator API.
70
+
71
+ * type
72
+ The type of error that occurred, such as "Authorization".
73
+
74
+ * message
75
+ A more detailed message about the particulars of the error.
76
+
77
+ <br/>
78
+
79
+ ## Testing
80
+
81
+ Run integration tests with real API Key.
82
+
83
+ ```ruby
84
+ ruby -I test test/mailinator_client_api_test.rb
85
+ ```
86
+
87
+ Most of the tests require env variables with valid values. Visit tests source code and review `mailinator_client_api_test.rb` file. The more env variables you set, the more tests are run.
88
+
89
+ * `MAILINATOR_TEST_API_TOKEN` - API tokens for authentication; basic requirement across many tests;see also https://manybrain.github.io/m8rdocs/#api-authentication
90
+ * `MAILINATOR_TEST_INBOX` - some already existing inbox within the private domain
91
+ * `MAILINATOR_TEST_PHONE_NUMBER` - associated phone number within the private domain; see also https://manybrain.github.io/m8rdocs/#fetch-an-sms-messages
92
+ * `MAILINATOR_TEST_MESSAGE_WITH_ATTACHMENT_ID` - existing message id within inbox (see above) within private domain (see above); see also https://manybrain.github.io/m8rdocs/#fetch-message
93
+ * `MAILINATOR_TEST_ATTACHMENT_ID` - existing message id within inbox (see above) within private domain (see above); see also https://manybrain.github.io/m8rdocs/#fetch-message
94
+ * `MAILINATOR_TEST_DELETE_DOMAIN` - don't use it unless you are 100% sure what you are doing
95
+
96
+
97
+ *****
98
+
99
+ Copyright (c) 2020 Manybrain, Inc
100
+
101
+ <https://www.mailinator.com/>
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require "rake/testtask"
4
+
5
+ desc "Default: run unit tests."
6
+ task :default => :test
7
+
8
+ Rake::TestTask.new(:test) do |t|
9
+ t.libs << "test"
10
+ t.pattern = 'test/**/*_test.rb'
11
+ t.verbose = true
12
+ end
@@ -0,0 +1,32 @@
1
+ # Domains Actions
2
+
3
+ Details on the various actions that can be performed on the Domains resource, including the expected parameters and the potential responses.
4
+
5
+ ##### Contents
6
+
7
+ * [GetDomains](#getdomains)
8
+ * [GetDomain](#getdomain)
9
+
10
+ <br/>
11
+
12
+ ## GetDomains
13
+
14
+ Fetches a list of all your domains
15
+
16
+ ```ruby
17
+ result = client.domains.get_domains()
18
+
19
+ puts result
20
+ ```
21
+
22
+ <br/>
23
+
24
+ ## GetDomain
25
+
26
+ Fetches a specific domain
27
+
28
+ ```ruby
29
+ result = client.domains.get_domain(domainId: my_domain_id)
30
+
31
+ puts result
32
+ ```
@@ -0,0 +1,176 @@
1
+ # Messages Actions
2
+
3
+ Details on the various actions that can be performed on the Messages resource, including the expected parameters and the potential responses.
4
+
5
+ ##### Contents
6
+
7
+ * [FetchInbox](#fetchinbox)
8
+ * [FetchMessage](#fetchmessage)
9
+ * [FetchSMSMessage](#fetchsmsmessage)
10
+ * [FetchAttachments](#fetchattachments)
11
+ * [FetchAttachment](#fetchattachment)
12
+ * [FetchMessageLinks](#fetchmessagelinks)
13
+ * [DeleteAllDomainMessages](#deletealldomainmessages)
14
+ * [DeleteAllInboxMessages](#deleteallinboxmessages)
15
+ * [DeleteMessage](#deletemessage)
16
+ * [InjectMessage](#injectmessage)
17
+
18
+ <br/>
19
+
20
+ ## FetchInbox
21
+
22
+ Retrieves a list of messages summaries
23
+
24
+ ```ruby
25
+ result = client.messages.fetch_inbox(
26
+ domainId: my_domain_id
27
+ inbox: my_inbox
28
+ skip: my_skip
29
+ limit: my_limit
30
+ sort: my_sort
31
+ decodeSubject: my_decode_subject)
32
+
33
+ puts result
34
+ ```
35
+
36
+ <br/>
37
+
38
+ ## FetchMessage
39
+
40
+ Retrieves a specific message by id
41
+
42
+ ```ruby
43
+ result = client.messages.fetch_inbox(
44
+ domainId: my_domain_id
45
+ inbox: my_inbox
46
+ messageId: my_message_id)
47
+
48
+ puts result
49
+ ```
50
+
51
+ <br/>
52
+
53
+
54
+ ## FetchSMSMessage
55
+
56
+ Retrieves a specific SMS message by sms number
57
+
58
+ ```ruby
59
+ result = client.messages.fetch_sms_message(
60
+ domainId: my_domain_id
61
+ inbox: my_inbox
62
+ teamSmsNumber: my_team_sms_number)
63
+
64
+ puts result
65
+ ```
66
+
67
+ <br/>
68
+
69
+
70
+ ## FetchAttachments
71
+
72
+ Retrieves a list of attachments for a message
73
+
74
+ ```ruby
75
+ result = client.messages.fetch_attachments(
76
+ domainId: my_domain_id
77
+ inbox: my_inbox
78
+ messageId: my_message_id)
79
+
80
+ puts result
81
+ ```
82
+
83
+ <br/>
84
+
85
+
86
+ ## FetchAttachment
87
+
88
+ Retrieves a specific attachment
89
+
90
+ ```ruby
91
+ result = client.messages.fetch_attachment(
92
+ domainId: my_domain_id
93
+ inbox: my_inbox
94
+ messageId: my_message_id
95
+ attachmentId: my_attachment_id)
96
+
97
+ puts result
98
+ ```
99
+
100
+ <br/>
101
+
102
+
103
+ ## FetchMessageLinks
104
+
105
+ Retrieves all links found within a given email
106
+
107
+ ```ruby
108
+ result = client.messages.fetch_message_links(
109
+ domainId: my_domain_id
110
+ inbox: my_inbox
111
+ messageId: my_message_id)
112
+
113
+ puts result
114
+ ```
115
+
116
+ <br/>
117
+
118
+
119
+ ## DeleteAllDomainMessages
120
+
121
+ Deletes ALL messages from a Private Domain
122
+
123
+ ```ruby
124
+ result = client.messages.delete_all_domain_messages(
125
+ domainId: my_domain_id)
126
+
127
+ puts result
128
+ ```
129
+
130
+ <br/>
131
+
132
+
133
+ ## DeleteAllInboxMessages
134
+
135
+ Deletes ALL messages from a specific private inbox
136
+
137
+ ```ruby
138
+ result = client.messages.delete_all_inbox_messages(
139
+ domainId: my_domain_id
140
+ inbox: my_inbox
141
+ messageId: my_message_id)
142
+
143
+ puts result
144
+ ```
145
+
146
+ <br/>
147
+
148
+
149
+ ## DeleteMessage
150
+
151
+ Deletes a specific messages
152
+
153
+ ```ruby
154
+ result = client.messages.delete_message(
155
+ domainId: my_domain_id
156
+ inbox: my_inbox
157
+ messageId: my_message_id)
158
+
159
+ puts result
160
+ ```
161
+
162
+ <br/>
163
+
164
+
165
+ ## InjectMessage
166
+
167
+ Deliver a JSON message into your private domain
168
+
169
+ ```ruby
170
+ result = client.messages.inject_message(
171
+ domainId: my_domain_id
172
+ inbox: my_inbox
173
+ messageToPost: my_message_to_post)
174
+
175
+ puts result
176
+ ```
@@ -0,0 +1,95 @@
1
+ # Rules Actions
2
+
3
+ Details on the various actions that can be performed on the Rules resource, including the expected parameters and the potential responses.
4
+
5
+ ##### Contents
6
+
7
+ * [CreateRule](#createrule)
8
+ * [EnableRule](#enablerule)
9
+ * [DisableRule](#disablerule)
10
+ * [GetAllRules](#getallrules)
11
+ * [GetRule](#getrule)
12
+ * [DeleteRule](#deleterule)
13
+
14
+ <br/>
15
+
16
+ ## CreateRule
17
+
18
+ Creates a Rule
19
+
20
+ ```ruby
21
+ result = client.rules.create_rule(
22
+ domainId: my_domain_id,
23
+ ruleToPost: my_rule_to_post
24
+ )
25
+
26
+ puts result
27
+ ```
28
+
29
+ <br/>
30
+
31
+ ## EnableRule
32
+
33
+ Enables an existing Rule
34
+
35
+ ```ruby
36
+ result = client.rules.enable_rule(
37
+ domainId: my_domain_id
38
+ ruleId: my_rule_id)
39
+
40
+ puts result
41
+ ```
42
+
43
+ <br/>
44
+
45
+ ## DisableRule
46
+
47
+ Disables an existing Rule
48
+
49
+ ```ruby
50
+ result = client.rules.disable_rule(
51
+ domainId: my_domain_id
52
+ ruleId: my_rule_id)
53
+
54
+ puts result
55
+ ```
56
+
57
+ <br/>
58
+
59
+ ## GetAllRules
60
+
61
+ Fetches all Rules for a Domain
62
+
63
+ ```ruby
64
+ result = client.rules.get_all_rules(domainId: my_domain_id)
65
+
66
+ puts result
67
+ ```
68
+
69
+ <br/>
70
+
71
+ ## GetRule
72
+
73
+ Fetches a specific rule for a Domain
74
+
75
+ ```ruby
76
+ result = client.rules.get_rule(
77
+ domainId: my_domain_id
78
+ ruleId: my_rule_id)
79
+
80
+ puts result
81
+ ```
82
+
83
+ <br/>
84
+
85
+ ## DeleteRule
86
+
87
+ Deletes a specific rule for a Domain
88
+
89
+ ```ruby
90
+ result = client.rules.delete_rule(
91
+ domainId: my_domain_id
92
+ ruleId: my_rule_id)
93
+
94
+ puts result
95
+ ```