Module: Millionsend
- Defined in:
- lib/millionsend.rb,
lib/millionsend/util.rb,
lib/millionsend/batch.rb,
lib/millionsend/error.rb,
lib/millionsend/emails.rb,
lib/millionsend/topics.rb,
lib/millionsend/request.rb,
lib/millionsend/version.rb,
lib/millionsend/contacts.rb,
lib/millionsend/segments.rb,
lib/millionsend/broadcasts.rb,
lib/millionsend/deliverability.rb
Overview
Ruby client for the MillionSend HTTP API. Configure once, then call the resource modules:
Millionsend.api_key = "ms_..."
Millionsend.base_url = "https://mail.acme.dev"
Millionsend::Emails.send(from: "onboarding@acme.dev", to: "you@example.com",
subject: "Hi", html: "<strong>it works</strong>")
api_key falls back to the MILLIONSEND_API_KEY env var; base_url to MILLIONSEND_BASE_URL and then http://localhost:3001 (MillionSend is self-hosted, so there is no cloud default). Plain http is only accepted for loopback hosts unless allow_insecure_http is set, since the API key travels as a bearer header. Every call returns a symbol-keyed Hash on success and raises a Millionsend::Error on any non-2xx response.
Defined Under Namespace
Modules: Batch, Broadcasts, Contacts, Deliverability, Emails, Segments, Topics, Util Classes: ApplicationError, Error, InvalidIdempotentRequestError, NotFoundError, Request, RestrictedApiKeyError, SendingPausedError, ValidationError
Constant Summary collapse
- DEFAULT_BASE_URL =
"http://localhost:3001"- USER_AGENT =
"millionsend-ruby/#{VERSION}"- ERROR_TYPES =
{ "validation_error" => ValidationError, "not_found" => NotFoundError, "restricted_api_key" => RestrictedApiKeyError, "sending_paused" => SendingPausedError, "invalid_idempotent_request" => InvalidIdempotentRequestError, "application_error" => ApplicationError, }.freeze
- VERSION =
"0.3.0"
Class Attribute Summary collapse
-
.allow_insecure_http ⇒ Object
Returns the value of attribute allow_insecure_http.
- .api_key ⇒ Object
- .base_url ⇒ Object
Class Attribute Details
.allow_insecure_http ⇒ Object
Returns the value of attribute allow_insecure_http.
35 36 37 |
# File 'lib/millionsend.rb', line 35 def allow_insecure_http @allow_insecure_http end |
.api_key ⇒ Object
37 38 39 |
# File 'lib/millionsend.rb', line 37 def api_key @api_key || ENV["MILLIONSEND_API_KEY"] end |
.base_url ⇒ Object
41 42 43 |
# File 'lib/millionsend.rb', line 41 def base_url @base_url || ENV["MILLIONSEND_BASE_URL"] || DEFAULT_BASE_URL end |