mailgun-ruby 1.4.0 → 1.4.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: 56b457f9a512474de60aebfe220b4cb31bcfcfcc032972ce2c5a1aa0ad1322c2
4
- data.tar.gz: 916852ea7483fe046b0d4c3c7883c79013b4378af43b2e6e978bf30f4dc9ef16
3
+ metadata.gz: 0f7b6ece85b0a809a90ea79e6836b55bc5a97cfe8cd036c1567acff92b8053c5
4
+ data.tar.gz: 277f0def30a104f86beef2c8ef3012b877fa94e35e415a9beff328cc76247280
5
5
  SHA512:
6
- metadata.gz: 7d43f29a5a245d06253ae97e44830c9768f494597506ce6ff4e87f28cc9071f12a959d0d3102f2d6f85140e5f373c2eefdd491064f804c12669618feef929594
7
- data.tar.gz: 3bbd64c03a2bad22f6d0853607e3bc97358ef7c55c35b2e0420c000fe7166422319c4a0f6bc80ddec2c6ad8aa99ba7a0bb5b6cd54e023de3a0491a0774e36143
6
+ metadata.gz: 3a419c6c2c8fbb7efa2ed08ad51da87441befe54e00e3a70db6626b82f353932827c5ebdd933f32edfe06ba043ea2dcba99cacd93a445f078ff089ad58af96ea
7
+ data.tar.gz: c910105de443193207c67c5afaa24b2d423dfb7b7e995466a95b8192d967f244f36e45142d78f97a46fb893809a633e793d75366ea206f83338b8f138a4ed3af
@@ -11,14 +11,13 @@ permissions:
11
11
 
12
12
  jobs:
13
13
  test:
14
-
15
14
  runs-on: ubuntu-latest
16
15
  strategy:
17
16
  matrix:
18
- ruby-version: [ '2.6', '2.7', '3.0', '3.1', '3.4' ]
17
+ ruby-version: [ '3.0', '3.1', '3.2', '3.3', '3.4', '4.0' ]
19
18
 
20
19
  steps:
21
- - uses: actions/checkout@v4
20
+ - uses: actions/checkout@v6
22
21
  - name: Set up Ruby
23
22
  uses: ruby/setup-ruby@v1
24
23
  with:
data/README.md CHANGED
@@ -19,7 +19,7 @@ gem install mailgun-ruby
19
19
  Gemfile:
20
20
 
21
21
  ```ruby
22
- gem 'mailgun-ruby', '~>1.4.0'
22
+ gem 'mailgun-ruby', '~>1.4.1'
23
23
  ```
24
24
 
25
25
  Usage
data/docs/Domains.md CHANGED
@@ -9,49 +9,102 @@ all calls except credentials.
9
9
 
10
10
  Usage - Domains
11
11
  -----------------------
12
-
12
+ First, instantiate the Mailgun Client with your API key
13
13
  ```ruby
14
- # First, instantiate the Mailgun Client with your API key
15
14
  mg_client = Mailgun::Client.new('your-api-key')
16
15
  domainer = Mailgun::Domains.new(mg_client)
16
+ ```
17
+
18
+ Core Domain methods:
17
19
 
20
+ ```ruby
18
21
  # Get a list of current domains.
19
22
  domainer.list
20
23
 
21
- # View details of a domain
22
- domainer.info 'my.perfect.domain'
23
-
24
24
  # Add a new domain
25
25
  domainer.create 'my.new.moreness'
26
26
  # or with options
27
27
  domainer.create 'my.new.moreness', { some: 'options' }
28
28
 
29
- # Remove a domain
30
- domainer.remove 'this.one.is.not.needed.'
29
+ # View details of a domain
30
+ domainer.get 'my.perfect.domain'
31
31
 
32
32
  # Update a domain
33
33
  domainer.update 'my.new.moreness', { some: 'options' }
34
+
35
+ # Verify a domain
36
+ domainer.verify 'my.perfect.domain'
37
+
38
+ # Remove a domain
39
+ domainer.remove 'this.one.is.not.needed.'
40
+
41
+
34
42
  ```
35
43
 
36
- Suppressions for a Domain
37
- -------------------------
44
+ Domain Keys methods:
45
+
46
+ ```ruby
47
+ # List keys for all domains
48
+ domainer.list_domain_keys { some: 'options' }
49
+
50
+ # Create a domain key
51
+ domainer.create_domain_key { some: 'options' }
52
+
53
+ # Delete a domain key
54
+ domainer.delete_domain_key { some: 'options' }
55
+
56
+ # Activate a domain key
57
+ domainer.activate_domain_key 'my.perfect.domain', 'selector'
58
+
59
+ # List domain keys
60
+ domainer.get_domain_keys 'my.perfect.domain'
61
+
62
+ # Deactivate a domain key
63
+ domainer.deactivate_domain_key 'my.perfect.domain', 'selector'
38
64
 
39
- You can manage domain suppressions (bounces, unsubscribes, complaints) using the
40
- [`Mailgun::Suppressions`](/docs/Suppressions.md) client:
65
+ # Update DKIM authority
66
+ domainer.update_domain_dkim_authority 'my.perfect.domain', { some: 'options' }
67
+
68
+ # Update a DKIM selector
69
+ domainer.update_domain_dkim_selector 'my.perfect.domain', { some: 'options' }
70
+ ```
71
+
72
+ Domain Tracking methods:
41
73
 
42
74
  ```ruby
43
- # Instantiate the Mailgun Client with your API key
44
- mg_client = Mailgun::Client.new('your-api-key')
45
- supp_client = mg_client.suppressions('example.org')
75
+ # Get tracking settings
76
+ domainer.get_domain_tracking_settings 'my.perfect.domain'
46
77
 
47
- # ...
78
+ # Update click tracking settings
79
+ domainer.update_domain_tracking_click_settings 'my.perfect.domain', { some: 'options' }
80
+
81
+ # Update open tracking settings
82
+ domainer.update_domain_tracking_open_settings 'my.perfect.domain', { some: 'options' }
83
+
84
+ # Update unsubscribe tracking settings
85
+ domainer.update_domain_tracking_unsubscribe_settings 'my.perfect.domain', { some: 'options' }
86
+
87
+ # Tracking Certificate: Get certificate and status
88
+ domainer.get_domain_tracking_certificate 'my.perfect.domain'
89
+
90
+ # Tracking Certificate: Regenerate expired certificate
91
+ domainer.regenerate_domain_tracking_certificate 'my.perfect.domain', { some: 'options' }
92
+
93
+ # Tracking Certificate: Generate
94
+ domainer.generate_domain_tracking_certificate 'my.perfect.domain', { some: 'options' }
48
95
  ```
49
96
 
50
- See the [Suppressions](/docs/Suppressions.md) for usage samples and
51
- [suppressions.rb](/lib/mailgun/suppressions.rb) for suppressions client API.
97
+ DKIM Security methods:
98
+
99
+ ```ruby
100
+ # Update Automatic Sender Security DKIM key rotation for a domain
101
+ domainer.dkim_rotation 'my.perfect.domain', true, { some: 'options' }
52
102
 
103
+ # Rotate Automatic Sender Security DKIM key for a domain
104
+ domainer.dkim_rotate 'my.perfect.domain'
105
+ ```
53
106
 
54
107
  More Documentation
55
108
  ------------------
56
- See the official [Mailgun Domain Docs](https://documentation.mailgun.com/en/latest/api-domains.html)
109
+ See the official [Mailgun Domain Docs](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domains)
57
110
  for more information
@@ -50,7 +50,7 @@ mb_obj.message_id("<20141014000000.11111.11111@example.com>")
50
50
  mb_obj.message_id(nil)
51
51
  mb_obj.message_id('')
52
52
 
53
- # Set the Message-tags at most 3.
53
+ # Set the Message-tags at most 10.
54
54
  mb_obj.add_tag("You can track mails as tag-units!")
55
55
 
56
56
  # Campaigns and headers.
@@ -1,5 +1,3 @@
1
- require 'mailgun/exceptions/exceptions'
2
-
3
1
  module Mailgun
4
2
 
5
3
  # Mailgun::Address is a simple interface to the Email Validation API.
@@ -1,7 +1,3 @@
1
- require 'mailgun/chains'
2
- require 'mailgun/suppressions'
3
- require 'mailgun/exceptions/exceptions'
4
-
5
1
  module Mailgun
6
2
  # A Mailgun::Client object is used to communicate with the Mailgun API. It is a
7
3
  # wrapper around Faraday so you don't have to worry about the HTTP aspect
@@ -15,7 +11,7 @@ module Mailgun
15
11
  api_host = Mailgun.api_host || 'api.mailgun.net',
16
12
  api_version = Mailgun.api_version || 'v3',
17
13
  ssl = true,
18
- test_mode = false,
14
+ test_mode = !!Mailgun.test_mode,
19
15
  timeout = nil,
20
16
  proxy_url = Mailgun.proxy_url)
21
17
 
@@ -32,14 +28,7 @@ module Mailgun
32
28
  }
33
29
  request_options.merge!(request: {timeout: timeout}) if timeout
34
30
 
35
- @http_client = Faraday.new(request_options) do |conn|
36
- conn.request :multipart
37
- conn.request :authorization, :basic, 'api', api_key
38
- conn.request :url_encoded
39
- conn.response :raise_error, include_request: true
40
- conn.adapter Faraday.default_adapter
41
- conn.options.params_encoder = Faraday::FlatParamsEncoder
42
- end
31
+ @http_client = build_http_client(api_key, request_options)
43
32
 
44
33
  @test_mode = test_mode
45
34
  @api_version = api_version
@@ -173,8 +162,16 @@ module Mailgun
173
162
  # @param [Hash] data This should be a standard Hash
174
163
  # containing required parameters for the requested resource.
175
164
  # @return [Mailgun::Response] A Mailgun::Response object.
176
- def put(resource_path, data)
177
- response = @http_client.put(resource_path, data)
165
+ def put(resource_path, params, body_params = false)
166
+ response =
167
+ if body_params
168
+ @http_client.put(resource_path) do |request|
169
+ request['Content-Type'] = 'application/json'
170
+ request.params = params.to_json
171
+ end
172
+ else
173
+ @http_client.put(resource_path, params)
174
+ end
178
175
  Response.new(response)
179
176
  rescue => err
180
177
  raise communication_error err
@@ -185,12 +182,19 @@ module Mailgun
185
182
  # @param [String] resource_path This is the API resource you wish to interact
186
183
  # with. Be sure to include your domain, where necessary.
187
184
  # @return [Mailgun::Response] A Mailgun::Response object.
188
- def delete(resource_path, params = nil)
189
- if params
190
- response = @http_client.delete(resource_path, params: params)
191
- else
192
- response = @http_client.delete(resource_path)
193
- end
185
+ def delete(resource_path, params = nil, body_params = false)
186
+ response =
187
+ if params
188
+ if body_params
189
+ @http_client.delete(resource_path) do |request|
190
+ request.body = params.to_json
191
+ end
192
+ else
193
+ @http_client.delete(resource_path, params: params)
194
+ end
195
+ else
196
+ @http_client.delete(resource_path)
197
+ end
194
198
  Response.new(response)
195
199
  rescue => err
196
200
  raise communication_error err
@@ -262,5 +266,16 @@ module Mailgun
262
266
  working_domain
263
267
  ) if message.fetch('from', []).empty? && message.fetch(:from, []).empty?
264
268
  end
269
+
270
+ def build_http_client(api_key, request_options)
271
+ Faraday.new(request_options) do |conn|
272
+ conn.request :multipart
273
+ conn.request :authorization, :basic, 'api', api_key
274
+ conn.request :url_encoded
275
+ conn.response :raise_error, include_request: true
276
+ conn.adapter Faraday.default_adapter
277
+ conn.options.params_encoder = Faraday::FlatParamsEncoder
278
+ end
279
+ end
265
280
  end
266
281
  end
@@ -1,6 +1,3 @@
1
- require 'mailgun/exceptions/exceptions'
2
- require 'mailgun/helpers/api_version_checker'
3
-
4
1
  module Mailgun
5
2
 
6
3
  # A Mailgun::Domains object is a simple CRUD interface to Mailgun Domains.
@@ -26,11 +23,6 @@ module Mailgun
26
23
  @client.get('domains', options).to_h['items']
27
24
  end
28
25
 
29
- def get_domains
30
- warn('The `get_domains` method will be deprecated in future versions of Mailgun. Please use `list` instead.')
31
- list
32
- end
33
-
34
26
  # Public: Add domain
35
27
  #
36
28
  # domain - [String] Name of the domain (ex. domain.com)
@@ -49,16 +41,6 @@ module Mailgun
49
41
  @client.post('domains', options).to_h
50
42
  end
51
43
 
52
- def add(domain, options = {})
53
- warn('The `add` method will be deprecated in future versions of Mailgun. Please use `create` instead.')
54
- create(domain, options)
55
- end
56
-
57
- def add_domain(domain, options = {})
58
- warn('The `add_domain` method will be deprecated in future versions of Mailgun. Please use `create` instead.')
59
- create(domain, options)
60
- end
61
-
62
44
  # Public: Get domain information
63
45
  #
64
46
  # domain - [String] Domain name to lookup
@@ -68,16 +50,6 @@ module Mailgun
68
50
  @client.get("domains/#{domain}").to_h!
69
51
  end
70
52
 
71
- def info(domain)
72
- warn('The `info` method will be deprecated in future versions of Mailgun. Please use `get` instead.')
73
- get(domain)
74
- end
75
-
76
- def get_domain(domain)
77
- warn('The `get_domain` method will be deprecated in future versions of Mailgun. Please use `get` instead.')
78
- get(domain)
79
- end
80
-
81
53
  # Public: Update domain
82
54
  #
83
55
  # domain - [String] Name of the domain (ex. domain.com)
@@ -96,9 +68,7 @@ module Mailgun
96
68
  end
97
69
 
98
70
 
99
- # Public: Verify domain, update domain records
100
- # Unknown status - this is not in the current Mailgun API
101
- # Do no rely on this being available in future releases.
71
+ # Public: Verify domain
102
72
  #
103
73
  # domain - [String] Domain name
104
74
  #
@@ -107,11 +77,6 @@ module Mailgun
107
77
  @client.put("domains/#{domain}/verify", nil).to_h!
108
78
  end
109
79
 
110
- def verify_domain(domain)
111
- warn('The `verify_domain` method will be deprecated in future versions of Mailgun. Please use `verify` instead.')
112
- verify(domain)
113
- end
114
-
115
80
  # Public: Delete Domain
116
81
  #
117
82
  # domain - [String] domain name to delete (ex. domain.com)
@@ -121,16 +86,6 @@ module Mailgun
121
86
  @client.delete("domains/#{domain}").to_h['message'] == 'Domain has been deleted'
122
87
  end
123
88
 
124
- def delete(domain)
125
- warn('The `delete` method will be deprecated in future versions of Mailgun. Please use `remove` instead.')
126
- remove(domain)
127
- end
128
-
129
- def delete_domain(domain)
130
- warn('The `delete_domain` method will be deprecated in future versions of Mailgun. Please use `remove` instead.')
131
- remove(domain)
132
- end
133
-
134
89
  # ==== End of Core Domains methods ====
135
90
 
136
91
  # ==== Domain::Keys methods ====
@@ -389,57 +344,17 @@ module Mailgun
389
344
 
390
345
  # ==== End of Reporting::Stats methods ====
391
346
 
392
- # ==== Deprecated methods ====
393
-
394
- # Public: Returns delivery connection settings for the defined domain.
395
- #
396
- # domain - [String] Name of the domain (ex. domain.com)
397
- #
398
- # Returns [Hash] Information on the delivery connection settings
399
- def get_domain_connection_settings(domain)
400
- @client.get("domains/#{domain}/connection").to_h
401
- end
402
-
403
- # Public: Updates the specified delivery connection settings for the defined domain.d
404
- #
405
- # domain - [String] Name of the domain (ex. domain.com)
406
- # options - [Hash] of
407
- # require_tls - [Boolean] true or false. If true - requires the message only be sent over a TLS connection
408
- # skip_verification - [Boolean] true or false. If true - the certificate and hostname will not be verified
409
- # when trying to establish a TLS connection
410
- #
411
- # Returns [Hash] Information on the delivery connection settings
412
- def update_domain_connection_settings(domain, options = {})
413
- @client.put("domains/#{domain}/connection", options).to_h
414
- end
415
-
416
- # Public: Update the CNAME used for tracking opens and clicks
417
- #
418
- # domain - [String] Name of the domain (ex. domain.com)
419
- # options - [Hash] of
420
- # web_prefix - [String] change the tracking CNAME for a domain.
421
- #
422
- # Returns [Hash] with message key
423
- def update_domain_web_prefix(domain, options = {})
424
- @client.put("domains/#{domain}/web_prefix", options).to_h
425
- end
426
-
427
- # ==== End of Deprecated methods ====
428
-
429
-
430
-
431
347
 
432
348
  enforces_api_version 'v1', :list_domain_keys, :create_domain_key, :delete_domain_key, :dkim_rotation,
433
349
  :dkim_rotate
434
350
  enforces_api_version 'v2', :get_domain_tracking_certificate, :regenerate_domain_tracking_certificate,
435
351
  :generate_domain_tracking_certificate
436
352
  enforces_api_version 'v3', :remove, :create_smtp_credentials, :update_smtp_credentials,
437
- :delete_smtp_credentials, :get_domain_connection_settings,
438
- :update_domain_connection_settings, :get_domain_tracking_settings,
353
+ :delete_smtp_credentials, :get_domain_tracking_settings,
439
354
  :update_domain_tracking_open_settings, :update_domain_tracking_click_settings,
440
355
  :update_domain_tracking_unsubscribe_settings, :update_domain_dkim_authority,
441
- :update_domain_dkim_selector, :update_domain_web_prefix, :get_domain_stats
356
+ :update_domain_dkim_selector, :get_domain_stats
442
357
  enforces_api_version 'v4', :get_domain_keys, :activate_domain_key, :deactivate_domain_key,
443
- :list, :info, :verify, :create, :update
358
+ :list, :verify, :create, :update
444
359
  end
445
360
  end
@@ -1,5 +1,3 @@
1
- require 'mailgun/exceptions/exceptions'
2
-
3
1
  module Mailgun
4
2
 
5
3
  # A Mailgun::Events object makes it really simple to consume
@@ -1,4 +1,6 @@
1
1
  module Mailgun
2
+ module Exceptions
3
+ end
2
4
 
3
5
  # Public: A basic class for mananging errors.
4
6
  # Inherits from StandardError (previously RuntimeError) as not all errors are
@@ -1,6 +1,3 @@
1
- require 'uri'
2
- require 'openssl'
3
-
4
1
  module Mailgun
5
2
 
6
3
  # Public: Provides methods for creating and handling opt-in URLs,
@@ -1,5 +1,3 @@
1
- require 'mailgun/exceptions/exceptions'
2
-
3
1
  module Mailgun
4
2
  # A Mailgun::Logs object is a simple interface to Mailgun Logs.
5
3
  # Uses Mailgun
@@ -1,5 +1,3 @@
1
- require 'mailgun/messages/message_builder'
2
-
3
1
  module Mailgun
4
2
 
5
3
  # A Mailgun::BatchMessage object is used to create a valid payload
@@ -1,7 +1,3 @@
1
- require 'mini_mime'
2
- require 'time'
3
- require 'faraday/multipart'
4
-
5
1
  module Mailgun
6
2
 
7
3
  # A Mailgun::MessageBuilder object is used to create a valid payload
@@ -1,5 +1,3 @@
1
- require 'mailgun/exceptions/exceptions'
2
-
3
1
  module Mailgun
4
2
  # A Mailgun::Metrics object is a simple interface to Mailgun Metrics.
5
3
  # Uses Mailgun
@@ -1,5 +1,3 @@
1
- require 'mailgun/exceptions/exceptions'
2
-
3
1
  module Mailgun
4
2
 
5
3
  # A Mailgun::Subaccounts object is a simple CRUD interface to Mailgun Subaccounts.
@@ -1,7 +1,3 @@
1
- require 'uri'
2
-
3
- require 'mailgun/exceptions/exceptions'
4
-
5
1
  module Mailgun
6
2
 
7
3
  # The Mailgun::Suppressions object makes it easy to manage "suppressions"
@@ -45,7 +41,7 @@ module Mailgun
45
41
  end
46
42
 
47
43
  def get_bounce(address)
48
- @client.get("#{@domain}/bounces/#{escape_address(address)}", nil)
44
+ @client.get("#{@domain}/bounces/#{escape_address(address)}")
49
45
  end
50
46
 
51
47
  def create_bounce(params = {})
@@ -187,7 +183,7 @@ module Mailgun
187
183
  end
188
184
 
189
185
  def get_complaint(address)
190
- @client.get("#{@domain}/complaints/#{escape_address(address)}", nil)
186
+ @client.get("#{@domain}/complaints/#{escape_address(address)}")
191
187
  end
192
188
 
193
189
  def create_complaint(params = {})
@@ -0,0 +1,32 @@
1
+ module Mailgun
2
+
3
+ # A Mailgun::AnalyticsTags object is a simple CRUD interface to Mailgun Tags.
4
+ # Uses Mailgun
5
+ class AnalyticsTags
6
+ include ApiVersionChecker
7
+
8
+ # Public: creates a new Mailgun::AnalyticsTags instance.
9
+ # Defaults to Mailgun::Client
10
+ def initialize(client = Mailgun::Client.new(Mailgun.api_key, Mailgun.api_host || 'api.mailgun.net', 'v1'))
11
+ @client = client
12
+ end
13
+
14
+ def update(tag, description)
15
+ @client.put('analytics/tags', { tag: tag, description: description }, body_params: true ).to_h['message'] == 'Tag updated'
16
+ end
17
+
18
+ def list(options = {})
19
+ @client.post('analytics/tags', options).to_h['items']
20
+ end
21
+
22
+ def remove(tag)
23
+ @client.delete('analytics/tags', { tag: tag }, body_params: true).to_h['message'] == 'Tag deleted'
24
+ end
25
+
26
+ def limits
27
+ @client.get('analytics/tags/limits').to_h
28
+ end
29
+
30
+ enforces_api_version 'v1', :update, :list, :remove, :limits
31
+ end
32
+ end
@@ -1,5 +1,3 @@
1
- require 'mailgun/exceptions/exceptions'
2
-
3
1
  module Mailgun
4
2
 
5
3
  # A Mailgun::Tags object is a simple CRUD interface to Mailgun Tags.
@@ -12,6 +10,9 @@ module Mailgun
12
10
  @client = client
13
11
  end
14
12
 
13
+ ### Deprecated Tags ###
14
+ # TODO: remove in v 1.5
15
+
15
16
  # Public: Get Tags
16
17
  #
17
18
  # domain - [String] Domain name where tag is stored
@@ -20,6 +21,7 @@ module Mailgun
20
21
  #
21
22
  # Returns [Array] A list of tags (hash)
22
23
  def get_tags(domain, options = {})
24
+ warn('This API is deprecated in favor of our new analytics Tags API')
23
25
  fail(ParameterError, 'No domain given to store template on', caller) unless domain
24
26
  @client.get("#{domain}/tags", options).to_h['items']
25
27
  end
@@ -31,6 +33,7 @@ module Mailgun
31
33
  #
32
34
  # Returns [Hash] Information on the requested tag.
33
35
  def get_tag(domain, tag)
36
+ warn('This API is deprecated in favor of our new analytics Tags API')
34
37
  fail(ParameterError, 'No domain given to find on Mailgun', caller) unless domain
35
38
  fail(ParameterError, 'No tag name given to find on provided domain', caller) unless tag
36
39
  @client.get("#{domain}/tags/#{tag}").to_h!
@@ -45,6 +48,7 @@ module Mailgun
45
48
  #
46
49
  # Returns [Boolean] if successful or not
47
50
  def update(domain, tag, options = {})
51
+ warn('This API is deprecated in favor of our new analytics Tags API')
48
52
  fail(ParameterError, 'No domain given to find on Mailgun', caller) unless domain
49
53
  fail(ParameterError, 'No tag name given to find on provided domain', caller) unless tag
50
54
  @client.put("#{domain}/tags/#{tag}", options).to_h['message'] == 'Tag updated'
@@ -63,6 +67,7 @@ module Mailgun
63
67
  #
64
68
  # Returns [Hash] of tag stats info
65
69
  def get_tag_stats(domain, tag, options = {})
70
+ warn('This API is deprecated in favor of our new analytics Tags API')
66
71
  fail(ParameterError, 'No domain given to find on Mailgun', caller) unless domain
67
72
  fail(ParameterError, 'No tag name given to find on provided domain', caller) unless tag
68
73
  @client.get("#{domain}/tags/#{tag}/stats", options).to_h
@@ -76,6 +81,7 @@ module Mailgun
76
81
  #
77
82
  # Returns [Boolean] if successful or not
78
83
  def remove(domain, tag)
84
+ warn('This API is deprecated in favor of our new analytics Tags API')
79
85
  fail(ParameterError, 'No domain given to remove on Mailgun', caller) unless domain
80
86
  fail(ParameterError, 'No template name given to find on provided domain', caller) unless tag
81
87
  @client.delete("#{domain}/tags/#{tag}").to_h['message'] == 'Tag deleted'
@@ -88,6 +94,7 @@ module Mailgun
88
94
  #
89
95
  # Returns [Hash] of countries of origin for a given domain
90
96
  def get_countries_aggregated_stats(domain, tag)
97
+ warn('This API is deprecated in favor of our new analytics Tags API')
91
98
  fail(ParameterError, 'No domain given to find on Mailgun', caller) unless domain
92
99
  fail(ParameterError, 'No tag name given to find on provided domain', caller) unless tag
93
100
  @client.get("#{domain}/tags/#{tag}/stats/aggregates/countries").to_h
@@ -100,6 +107,7 @@ module Mailgun
100
107
  #
101
108
  # Returns [Hash] of email providers for a given domain
102
109
  def get_providers_aggregated_stats(domain, tag)
110
+ warn('This API is deprecated in favor of our new analytics Tags API')
103
111
  fail(ParameterError, 'No domain given to find on Mailgun', caller) unless domain
104
112
  fail(ParameterError, 'No tag name given to find on provided domain', caller) unless tag
105
113
  @client.get("#{domain}/tags/#{tag}/stats/aggregates/providers").to_h
@@ -112,6 +120,7 @@ module Mailgun
112
120
  #
113
121
  # Returns [Hash] of devices for a given domain
114
122
  def get_devices_aggregated_stats(domain, tag)
123
+ warn('This API is deprecated in favor of our new analytics Tags API')
115
124
  fail(ParameterError, 'No domain given to find on Mailgun', caller) unless domain
116
125
  fail(ParameterError, 'No tag name given to find on provided domain', caller) unless tag
117
126
  @client.get("#{domain}/tags/#{tag}/stats/aggregates/devices").to_h
@@ -1,5 +1,3 @@
1
- require 'mailgun/exceptions/exceptions'
2
-
3
1
  module Mailgun
4
2
 
5
3
  # A Mailgun::Templates object is a simple CRUD interface to Mailgun Templates.
@@ -1,4 +1,4 @@
1
1
  # It's the version. Yeay!
2
2
  module Mailgun
3
- VERSION = '1.4.0'
3
+ VERSION = '1.4.1'
4
4
  end
data/lib/mailgun-ruby.rb CHANGED
@@ -1,2 +1,2 @@
1
- require 'mailgun'
2
- require 'railgun' if defined?(Rails) && defined?(ActionMailer)
1
+ require_relative 'mailgun'
2
+ require_relative 'railgun' if defined?(Rails) && defined?(ActionMailer)