Module: MailchimpAPI::Client::BatchMethods
- Included in:
- MailchimpAPI::Client
- Defined in:
- lib/mailchimp-api/client/batch_methods.rb
Overview
Methods to create and run batch requests
Instance Method Summary collapse
-
#batch(batch_requests, query: nil) ⇒ Response
Executes a batch of requests.
-
#batch_delete_request(path, query: nil, body: nil, headers: nil, operation_id: nil) ⇒ BatchRequest
Creates a new batch DELETE request.
-
#batch_get_request(path, query: nil, body: nil, headers: nil, operation_id: nil) ⇒ BatchRequest
Creates a new batch GET request.
-
#batch_patch_request(path, query: nil, body: nil, headers: nil, operation_id: nil) ⇒ BatchRequest
Creates a new batch PATCH request.
-
#batch_post_request(path, query: nil, body: nil, headers: nil, operation_id: nil) ⇒ BatchRequest
Creates a new batch POST request.
-
#batch_put_request(path, query: nil, body: nil, headers: nil, operation_id: nil) ⇒ BatchRequest
Creates a new batch PUT request.
Instance Method Details
#batch(batch_requests, query: nil) ⇒ Response
Executes a batch of requests
82 83 84 85 |
# File 'lib/mailchimp-api/client/batch_methods.rb', line 82 def batch(batch_requests, query: nil) operations = batch_requests.map(&:operation) post("batches", query: query, body: {operations: operations}) end |
#batch_delete_request(path, query: nil, body: nil, headers: nil, operation_id: nil) ⇒ BatchRequest
Creates a new batch DELETE request
68 69 70 |
# File 'lib/mailchimp-api/client/batch_methods.rb', line 68 def batch_delete_request(path, query: nil, body: nil, headers: nil, operation_id: nil) new_batch_request(Net::HTTP::Delete, path, query: query, body: body, headers: headers, operation_id: operation_id) end |
#batch_get_request(path, query: nil, body: nil, headers: nil, operation_id: nil) ⇒ BatchRequest
Creates a new batch GET request
16 17 18 |
# File 'lib/mailchimp-api/client/batch_methods.rb', line 16 def batch_get_request(path, query: nil, body: nil, headers: nil, operation_id: nil) new_batch_request(Net::HTTP::Get, path, query: query, body: body, headers: headers, operation_id: operation_id) end |
#batch_patch_request(path, query: nil, body: nil, headers: nil, operation_id: nil) ⇒ BatchRequest
Creates a new batch PATCH request
55 56 57 |
# File 'lib/mailchimp-api/client/batch_methods.rb', line 55 def batch_patch_request(path, query: nil, body: nil, headers: nil, operation_id: nil) new_batch_request(Net::HTTP::Patch, path, query: query, body: body, headers: headers, operation_id: operation_id) end |
#batch_post_request(path, query: nil, body: nil, headers: nil, operation_id: nil) ⇒ BatchRequest
Creates a new batch POST request
29 30 31 |
# File 'lib/mailchimp-api/client/batch_methods.rb', line 29 def batch_post_request(path, query: nil, body: nil, headers: nil, operation_id: nil) new_batch_request(Net::HTTP::Post, path, query: query, body: body, headers: headers, operation_id: operation_id) end |
#batch_put_request(path, query: nil, body: nil, headers: nil, operation_id: nil) ⇒ BatchRequest
Creates a new batch PUT request
42 43 44 |
# File 'lib/mailchimp-api/client/batch_methods.rb', line 42 def batch_put_request(path, query: nil, body: nil, headers: nil, operation_id: nil) new_batch_request(Net::HTTP::Put, path, query: query, body: body, headers: headers, operation_id: operation_id) end |