Class: Postscale::Client
- Inherits:
-
Object
- Object
- Postscale::Client
- Defined in:
- lib/postscale/client.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#http ⇒ Object
readonly
Returns the value of attribute http.
Instance Method Summary collapse
- #aliases ⇒ Object
- #dkim ⇒ Object
- #domains ⇒ Object
-
#emails ⇒ Object
—– Resource accessors —–.
- #inbound ⇒ Object
-
#initialize(api_key: nil, base_url: nil, timeout: Configuration::DEFAULT_TIMEOUT, max_retries: Configuration::DEFAULT_MAX_RETRIES, headers: nil, transport: nil, sleeper: nil) ⇒ Client
constructor
Initialize a new Postscale API client.
- #stats ⇒ Object
- #suppressions ⇒ Object
- #templates ⇒ Object
- #trust ⇒ Object
- #usage ⇒ Object
- #warming ⇒ Object
- #webhooks ⇒ Object
Constructor Details
#initialize(api_key: nil, base_url: nil, timeout: Configuration::DEFAULT_TIMEOUT, max_retries: Configuration::DEFAULT_MAX_RETRIES, headers: nil, transport: nil, sleeper: nil) ⇒ Client
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/postscale/client.rb', line 18 def initialize(api_key: nil, base_url: nil, timeout: Configuration::DEFAULT_TIMEOUT, max_retries: Configuration::DEFAULT_MAX_RETRIES, headers: nil, transport: nil, sleeper: nil) resolved_api_key = api_key || ENV["POSTSCALE_API_KEY"] resolved_base_url = base_url || ENV["POSTSCALE_BASE_URL"] || Configuration::DEFAULT_BASE_URL @config = Configuration.new( api_key: resolved_api_key, base_url: resolved_base_url, timeout: timeout, max_retries: max_retries, headers: headers, transport: transport, sleeper: sleeper ) @http = HttpClient.new(@config) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/postscale/client.rb', line 5 def config @config end |
#http ⇒ Object (readonly)
Returns the value of attribute http.
5 6 7 |
# File 'lib/postscale/client.rb', line 5 def http @http end |
Instance Method Details
#aliases ⇒ Object
48 49 50 |
# File 'lib/postscale/client.rb', line 48 def aliases @aliases ||= Resources::Aliases.new(@http) end |
#dkim ⇒ Object
44 45 46 |
# File 'lib/postscale/client.rb', line 44 def dkim @dkim ||= Resources::DKIM.new(@http) end |
#domains ⇒ Object
40 41 42 |
# File 'lib/postscale/client.rb', line 40 def domains @domains ||= Resources::Domains.new(@http) end |
#emails ⇒ Object
—– Resource accessors —–
36 37 38 |
# File 'lib/postscale/client.rb', line 36 def emails @emails ||= Resources::Emails.new(@http) end |
#inbound ⇒ Object
52 53 54 |
# File 'lib/postscale/client.rb', line 52 def inbound @inbound ||= Resources::Inbound.new(@http) end |
#stats ⇒ Object
56 57 58 |
# File 'lib/postscale/client.rb', line 56 def stats @stats ||= Resources::Stats.new(@http) end |
#suppressions ⇒ Object
64 65 66 |
# File 'lib/postscale/client.rb', line 64 def suppressions @suppressions ||= Resources::Suppressions.new(@http) end |
#templates ⇒ Object
72 73 74 |
# File 'lib/postscale/client.rb', line 72 def templates @templates ||= Resources::Templates.new(@http) end |
#trust ⇒ Object
80 81 82 |
# File 'lib/postscale/client.rb', line 80 def trust @trust ||= Resources::Trust.new(@http) end |
#usage ⇒ Object
76 77 78 |
# File 'lib/postscale/client.rb', line 76 def usage @usage ||= Resources::Usage.new(@http) end |