Class: MailerLite::Batch
- Inherits:
-
Object
- Object
- MailerLite::Batch
- Defined in:
- lib/mailerlite/batch/batch.rb
Overview
This is a class for manipulating the Batch from MailerLite API.
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client: MailerLite::Client.new) ⇒ Batch
constructor
Inits the ‘Batch` class with the specified `client`.
-
#request(requests:) ⇒ HTTP::Response
Create a Batch Request.
Constructor Details
#initialize(client: MailerLite::Client.new) ⇒ Batch
Inits the ‘Batch` class with the specified `client`.
11 12 13 |
# File 'lib/mailerlite/batch/batch.rb', line 11 def initialize(client: MailerLite::Client.new) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/mailerlite/batch/batch.rb', line 6 def client @client end |
Instance Method Details
#request(requests:) ⇒ HTTP::Response
Create a Batch Request
19 20 21 22 |
# File 'lib/mailerlite/batch/batch.rb', line 19 def request(requests:) params = { requests: requests } client.http.post("#{MAILERLITE_API_URL}/batch", body: params.to_json) end |