mailgun_api 0.2.0 → 0.2.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 +8 -8
- data/lib/mailgun/domain.rb +23 -0
- data/lib/mailgun/list.rb +5 -5
- data/lib/mailgun_api.rb +5 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmU3OTk4ZGY5NjdkNTMxMTI5NmU2YzlkOTMzZTQ0YmFkNjdhZmExMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjUwNTA5NWVmZjc0ZjQ3YWVjNmVkNGU3OWIxMzliNTQyYmFlODgxNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmEwZjU2ZDZlN2JkOGVjZmI1MDAyZDEyNjMyMzIxZDMyNWYwOWNmYWFiYzdm
|
10
|
+
NDA3OTRmMDVlYzhkMjU2YTQ3ODkzNmM1MjM3OTZiNDU0ZWE2NDI1OTdlNjcw
|
11
|
+
ZTdhZGE1NjI0YzJjY2MwMGI2YWNiZmYwMGZiNDA2YTUzYmVmZjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzBiNjhmYWExNjVlYTkwYzQ1MDIzYmQyNTA4ZWZlOTNkMjZkNzZmOTFiNDU2
|
14
|
+
M2I5ZTk0OTJkY2E0NmJhNWM0YmQ2Y2ZiYjY2MDg3NzhkM2QxY2ZhMGUwNjFh
|
15
|
+
OTkyMTU0YjUxNWMxYmU1OGJhYmEzMTI0ZWZkZGIxMjFiMDY5Mzg=
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Mailgun
|
2
|
+
|
3
|
+
# Domain functionality
|
4
|
+
# Refer http://documentation.mailgun.com/api-domains.html for optional parameters
|
5
|
+
|
6
|
+
|
7
|
+
class Domain
|
8
|
+
attr_accessor :properties
|
9
|
+
|
10
|
+
|
11
|
+
# Used internally
|
12
|
+
def initialize(mailgun)
|
13
|
+
@mailgun = mailgun
|
14
|
+
end
|
15
|
+
|
16
|
+
# List all domains
|
17
|
+
def list(options={})
|
18
|
+
@mailgun.response = Mailgun::Base.fire(:get, @mailgun.api_url + "/domains")["items"] || []
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/lib/mailgun/list.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'pry'
|
2
|
-
|
3
1
|
module Mailgun
|
4
2
|
|
5
3
|
# Mailing List functionality
|
@@ -130,9 +128,11 @@ module Mailgun
|
|
130
128
|
|
131
129
|
|
132
130
|
def add_members(members)
|
133
|
-
|
134
|
-
|
135
|
-
|
131
|
+
members.each_slice(1000).each do |members_chunk|
|
132
|
+
params = {}
|
133
|
+
params['members'] = members_chunk.to_json
|
134
|
+
@mailgun.response = Mailgun::Base.fire(:post, list_url(self.address) + "/members.json", params)
|
135
|
+
end
|
136
136
|
end
|
137
137
|
|
138
138
|
|
data/lib/mailgun_api.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "rest-client"
|
2
2
|
require "json"
|
3
3
|
require "mailgun/list"
|
4
|
+
require "mailgun/domain"
|
4
5
|
require "mailgun/error"
|
5
6
|
require "mailgun/message"
|
6
7
|
|
@@ -110,6 +111,10 @@ module Mailgun
|
|
110
111
|
Mailgun::List.new(self).list
|
111
112
|
end
|
112
113
|
|
114
|
+
def domains
|
115
|
+
Mailgun::Domain.new(self).list
|
116
|
+
end
|
117
|
+
|
113
118
|
def create_list(list_name, options={})
|
114
119
|
Mailgun::List.new(self).create("#{list_name}@#{domain}", options)
|
115
120
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailgun_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Irey
|
@@ -46,6 +46,7 @@ extra_rdoc_files: []
|
|
46
46
|
files:
|
47
47
|
- lib/mailgun_api.rb
|
48
48
|
- lib/mailgun/list.rb
|
49
|
+
- lib/mailgun/domain.rb
|
49
50
|
- lib/mailgun/message.rb
|
50
51
|
- lib/mailgun/error.rb
|
51
52
|
homepage: http://rubygems.org/gems/mailgun_api
|