Class: UniOne::Client

Inherits:
Object
  • Object
show all
Extended by:
Validation::ClassMethods
Includes:
Domain, Email, EventDump, Helpers, Project, Suppression, System, Tag, Template, Unsubscribed, Webhook, Connection, Validation::InstanceMethods
Defined in:
lib/unione/client.rb,
lib/unione/helpers.rb,
lib/unione/client/tag.rb,
lib/unione/client/email.rb,
lib/unione/client/domain.rb,
lib/unione/client/system.rb,
lib/unione/client/project.rb,
lib/unione/client/webhook.rb,
lib/unione/client/template.rb,
lib/unione/client/event_dump.rb,
lib/unione/client/suppression.rb,
lib/unione/client/unsubscribed.rb

Defined Under Namespace

Modules: Domain, Email, EventDump, Helpers, Project, Suppression, System, Tag, Template, Unsubscribed, Webhook Classes: BaseException, InvalidCallbackAuth

Constant Summary collapse

API_ENDPOINT =
'https://%{hostname}/%{lang}/transactional/api/v1/'

Instance Method Summary collapse

Methods included from Validation::ClassMethods

add_response_validations

Methods included from Webhook

#delete_webhook, #get_webhook, #list_webhooks, #set_webhook

Methods included from Unsubscribed

#check_unsubscribed, #list_unsubscribed, #unsubscribe

Methods included from Template

#delete_template, #get_template, #list_templates, #set_template

Methods included from Tag

#delete_tag, #list_tags

Methods included from System

#info

Methods included from Suppression

#delete_suppression, #get_suppression, #list_suppressions, #set_suppression

Methods included from Project

#create_project, #delete_project, #list_projects, #update_project

Methods included from EventDump

#create_event_dump, #delete_event_dump, #get_event_dump, #list_event_dumps

Methods included from Email

#send_email, #subscribe_email

Methods included from Domain

#get_dns_records, #list_domains, #validate_dkim, #validate_verification_record

Methods included from Helpers

#callback_helper, #verify_callback_auth!

Methods included from Connection

#get, #post

Constructor Details

#initialize(params = {}) ⇒ Client

  • Args :

    • hostname -> string, API hostname, for example ‘eu1.unione.io’

    • lang -> string, two-letter ISO 639-1 language abbreviation, e.g. ‘en’

    • api_key -> string, your UniOne API key

    • timeout -> integer, timeout in seconds, 5 by default

    • api_key_in_params -> boolean, pass API key in parameters, otherwise pass in headers (default)

    • enable_logging -> boolean, enable logging



45
46
47
48
49
50
51
52
# File 'lib/unione/client.rb', line 45

def initialize(params = {})
  @hostname          = params[:hostname]
  @lang              = params[:lang] || 'en'
  @api_key           = params[:api_key]
  @timeout           = params[:timeout] || 5
  @api_key_in_params = params[:api_key_in_params]
  @enable_logging    = params[:enable_logging] || ENV['ENABLE_LOGGING']
end