Module: Postscale

Defined in:
lib/postscale.rb,
lib/postscale/client.rb,
lib/postscale/errors.rb,
lib/postscale/version.rb,
lib/postscale/response.rb,
lib/postscale/attachments.rb,
lib/postscale/http_client.rb,
lib/postscale/configuration.rb,
lib/postscale/resources/dkim.rb,
lib/postscale/resources/stats.rb,
lib/postscale/resources/trust.rb,
lib/postscale/resources/usage.rb,
lib/postscale/resources/emails.rb,
lib/postscale/resources/aliases.rb,
lib/postscale/resources/domains.rb,
lib/postscale/resources/inbound.rb,
lib/postscale/resources/warming.rb,
lib/postscale/resources/resource.rb,
lib/postscale/resources/webhooks.rb,
lib/postscale/resources/templates.rb,
lib/postscale/webhook_verification.rb,
lib/postscale/resources/suppressions.rb

Defined Under Namespace

Modules: Attachments, Resources, Webhook Classes: APIError, Client, Configuration, ConfigurationError, Error, Headers, HttpClient, Result, ValidationError, WebhookVerificationResult

Constant Summary collapse

VERSION =
"1.0.0"
Response =
Result

Class Method Summary collapse

Class Method Details

.attachment_from_bytes(filename, data, content_type = "application/octet-stream") ⇒ Object



47
48
49
# File 'lib/postscale.rb', line 47

def attachment_from_bytes(filename, data, content_type = "application/octet-stream")
  Attachments.from_bytes(filename, data, content_type)
end

.attachment_from_file(path, content_type = "application/octet-stream") ⇒ Object



43
44
45
# File 'lib/postscale.rb', line 43

def attachment_from_file(path, content_type = "application/octet-stream")
  Attachments.from_file(path, content_type)
end

.clientObject



35
36
37
# File 'lib/postscale.rb', line 35

def client
  @client ||= Client.new
end

.configure(**options) ⇒ Object



39
40
41
# File 'lib/postscale.rb', line 39

def configure(**options)
  @client = Client.new(**options)
end

.method_missing(method, *args, **kwargs, &block) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/postscale.rb', line 59

def method_missing(method, *args, **kwargs, &block)
  if client.respond_to?(method)
    client.public_send(method, *args, **kwargs, &block)
  else
    super
  end
end

.respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/postscale.rb', line 67

def respond_to_missing?(method, include_private = false)
  client.respond_to?(method, include_private) || super
end

.sign_webhook_body(body, secret, timestamp: Time.now.to_i) ⇒ Object



55
56
57
# File 'lib/postscale.rb', line 55

def sign_webhook_body(body, secret, timestamp: Time.now.to_i)
  Webhook.sign_body(body, secret, timestamp: timestamp)
end

.verify_webhook_signature(body, header, secrets, **options) ⇒ Object



51
52
53
# File 'lib/postscale.rb', line 51

def verify_webhook_signature(body, header, secrets, **options)
  Webhook.verify_signature(body, header, secrets, **options)
end