Class: SocketLabs::InjectionApi::SocketLabsClient
- Inherits:
-
Object
- Object
- SocketLabs::InjectionApi::SocketLabsClient
- Defined in:
- lib/socketlabs/injectionapi/socketlabsclient.rb
Instance Attribute Summary collapse
-
#request_json ⇒ Object
readonly
Returns the value of attribute request_json.
-
#response_json ⇒ Object
readonly
Returns the value of attribute response_json.
Instance Method Summary collapse
-
#initialize(server_id, api_key, proxy = {}) ⇒ SocketLabsClient
constructor
A new instance of SocketLabsClient.
-
#send(message) ⇒ SendResponse
Sends a Message message and returns the response from the Injection API.
- #to_s ⇒ Object
Constructor Details
#initialize(server_id, api_key, proxy = {}) ⇒ SocketLabsClient
Returns a new instance of SocketLabsClient.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/socketlabs/injectionapi/socketlabsclient.rb', line 21 def initialize ( server_id, api_key, proxy= {} ) @server_id = server_id @api_key = api_key @proxy = proxy @endpoint = "https://inject.socketlabs.com/api/v1/email" end |
Instance Attribute Details
#request_json ⇒ Object (readonly)
Returns the value of attribute request_json.
18 19 20 |
# File 'lib/socketlabs/injectionapi/socketlabsclient.rb', line 18 def request_json @request_json end |
#response_json ⇒ Object (readonly)
Returns the value of attribute response_json.
19 20 21 |
# File 'lib/socketlabs/injectionapi/socketlabsclient.rb', line 19 def response_json @response_json end |
Instance Method Details
#send(message) ⇒ SendResponse
Sends a Message message and returns the response from the Injection API.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/socketlabs/injectionapi/socketlabsclient.rb', line 35 def send() response = SendResponse.new if .instance_of? BasicMessage response = () end if .instance_of? BulkMessage response = () end response end |
#to_s ⇒ Object
51 52 53 |
# File 'lib/socketlabs/injectionapi/socketlabsclient.rb', line 51 def to_s "#{@endpoint}::#{@server_id}:#{@api_key}" end |