Class: Mailflow::Client
- Inherits:
-
Object
- Object
- Mailflow::Client
- Defined in:
- lib/mailflow/client.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#server_key ⇒ Object
readonly
Returns the value of attribute server_key.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(host, server_key) ⇒ Client
constructor
A new instance of Client.
- #messages ⇒ Object
- #moonrope ⇒ Object
- #send_message(&block) ⇒ Object
- #send_raw_message(&block) ⇒ Object
Constructor Details
#initialize(host, server_key) ⇒ Client
Returns a new instance of Client.
14 15 16 17 |
# File 'lib/mailflow/client.rb', line 14 def initialize(host, server_key) @host = host @server_key = server_key end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
8 9 10 |
# File 'lib/mailflow/client.rb', line 8 def host @host end |
#server_key ⇒ Object (readonly)
Returns the value of attribute server_key.
8 9 10 |
# File 'lib/mailflow/client.rb', line 8 def server_key @server_key end |
Class Method Details
.instance ⇒ Object
10 11 12 |
# File 'lib/mailflow/client.rb', line 10 def self.instance @instance ||= new(Mailflow.config.host, Mailflow.config.server_key) end |
Instance Method Details
#messages ⇒ Object
19 20 21 |
# File 'lib/mailflow/client.rb', line 19 def ||= MessageScope.new(self) end |
#moonrope ⇒ Object
35 36 37 |
# File 'lib/mailflow/client.rb', line 35 def moonrope @moonrope ||= MoonropeClient::Connection.new(@host, headers: { 'X-Server-API-Key' => @server_key }, ssl: true) end |
#send_message(&block) ⇒ Object
23 24 25 26 27 |
# File 'lib/mailflow/client.rb', line 23 def (&block) = SendMessage.new(self) block.call() .send! end |
#send_raw_message(&block) ⇒ Object
29 30 31 32 33 |
# File 'lib/mailflow/client.rb', line 29 def (&block) = SendRawMessage.new(self) block.call() .send! end |