Class: Rubymail::Base
Instance Method Summary collapse
- #addresses(domain = Rubymail.domain) ⇒ Object
- #base_url ⇒ Object
- #bounces(domain = Rubymail.domain) ⇒ Object
- #complaints(domain = Rubymail.domain) ⇒ Object
- #domains ⇒ Object
-
#initialize(options) ⇒ Base
constructor
A new instance of Base.
- #list_members(address) ⇒ Object
- #lists ⇒ Object
- #log(domain = Rubymail.domain) ⇒ Object
- #mailboxes(domain = Rubymail.domain) ⇒ Object
- #messages(domain = Rubymail.domain) ⇒ Object
- #public_base_url ⇒ Object
- #routes ⇒ Object
- #secure ⇒ Object
- #unsubscribes(domain = Rubymail.domain) ⇒ Object
- #webhooks(domain = Rubymail.domain, webhook_url = Rubymail.webhook_url) ⇒ Object
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/rubymail/base.rb', line 4 def initialize() Rubymail.rubymail_host = .fetch(:rubymail_host) { "api.rubymail.net" } Rubymail.protocol = .fetch(:protocol) { "https" } Rubymail.api_version = .fetch(:api_version) { "v3" } Rubymail.test_mode = .fetch(:test_mode) { false } Rubymail.api_key = .fetch(:api_key) { raise ArgumentError.new(":api_key is a required argument to initialize Rubymail") if Rubymail.api_key.nil? } Rubymail.domain = .fetch(:domain) { nil } Rubymail.webhook_url = .fetch(:webhook_url) { nil } Rubymail.public_api_key = .fetch(:public_api_key) { nil } end |
Instance Method Details
#addresses(domain = Rubymail.domain) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/rubymail/base.rb', line 51 def addresses(domain = Rubymail.domain) if Rubymail.public_api_key.nil? raise ArgumentError.new(":public_api_key is a required argument to validate addresses") end Rubymail::Address.new(self) end |
#base_url ⇒ Object
15 16 17 |
# File 'lib/rubymail/base.rb', line 15 def base_url "#{Rubymail.protocol}://api:#{Rubymail.api_key}@#{Rubymail.rubymail_host}/#{Rubymail.api_version}" end |
#bounces(domain = Rubymail.domain) ⇒ Object
35 36 37 |
# File 'lib/rubymail/base.rb', line 35 def bounces(domain = Rubymail.domain) Rubymail::Bounce.new(self, domain) end |
#complaints(domain = Rubymail.domain) ⇒ Object
58 59 60 |
# File 'lib/rubymail/base.rb', line 58 def complaints(domain = Rubymail.domain) Rubymail::Complaint.new(self, domain) end |
#domains ⇒ Object
39 40 41 |
# File 'lib/rubymail/base.rb', line 39 def domains Rubymail::Domain.new(self) end |
#list_members(address) ⇒ Object
70 71 72 |
# File 'lib/rubymail/base.rb', line 70 def list_members(address) Rubymail::MailingList::Member.new(self, address) end |
#lists ⇒ Object
66 67 68 |
# File 'lib/rubymail/base.rb', line 66 def lists @lists ||= Rubymail::MailingList.new(self) end |
#log(domain = Rubymail.domain) ⇒ Object
62 63 64 |
# File 'lib/rubymail/base.rb', line 62 def log(domain=Rubymail.domain) Rubymail::Log.new(self, domain) end |
#mailboxes(domain = Rubymail.domain) ⇒ Object
23 24 25 |
# File 'lib/rubymail/base.rb', line 23 def mailboxes(domain = Rubymail.domain) Rubymail::Mailbox.new(self, domain) end |
#messages(domain = Rubymail.domain) ⇒ Object
27 28 29 |
# File 'lib/rubymail/base.rb', line 27 def (domain = Rubymail.domain) @messages ||= Rubymail::Message.new(self, domain) end |
#public_base_url ⇒ Object
19 20 21 |
# File 'lib/rubymail/base.rb', line 19 def public_base_url "#{Rubymail.protocol}://api:#{Rubymail.public_api_key}@#{Rubymail.rubymail_host}/#{Rubymail.api_version}" end |
#routes ⇒ Object
31 32 33 |
# File 'lib/rubymail/base.rb', line 31 def routes @routes ||= Rubymail::Route.new(self) end |
#secure ⇒ Object
74 75 76 |
# File 'lib/rubymail/base.rb', line 74 def secure Rubymail::Secure.new(self) end |