module Mailflow::APIOperations::ClassMethods
Public Instance Methods
base_params()
click to toggle source
# File lib/mailflow-ruby/api_operations.rb, line 26 def base_params (Mailflow.test_mode) ? {} : {digest_auth: {username: Mailflow.config.api_key, password: Mailflow.config.api_secret}} end
delete_request(endpoint, params = {})
click to toggle source
# File lib/mailflow-ruby/api_operations.rb, line 21 def delete_request(endpoint, params = {}) options = base_params.merge({ body: params.to_json, headers: { "Content-Type" => "application/json", 'Accept'=>'application/json'} }) HTTParty.delete(url(endpoint), options) end
get_request(endpoint, params = {})
click to toggle source
# File lib/mailflow-ruby/api_operations.rb, line 11 def get_request(endpoint, params = {}) options = base_params.merge({query: params}) HTTParty.get(url(endpoint), options) end
post_request(endpoint, params = {})
click to toggle source
# File lib/mailflow-ruby/api_operations.rb, line 16 def post_request(endpoint, params = {}) options = base_params.merge({ body: params.to_json, headers: { "Content-Type" => "application/json", 'Accept'=>'application/json'} }) HTTParty.post(url(endpoint), options) end
url(endpoint)
click to toggle source
# File lib/mailflow-ruby/api_operations.rb, line 7 def url(endpoint) "https://mailflowhq.com/api/#{endpoint}" end