class SurenotifyRails::Client

Attributes

api_key[R]
verify_ssl[R]

Public Class Methods

new(api_key, verify_ssl = true) click to toggle source
# File lib/surenotify_rails/client.rb, line 8
def initialize(api_key, verify_ssl = true)
  @api_key = api_key
  @verify_ssl = verify_ssl
end

Public Instance Methods

api_url() click to toggle source
# File lib/surenotify_rails/client.rb, line 31
def api_url
  'https://mail.surenotifyapi.com/v1'
end
send_message(options) click to toggle source
# File lib/surenotify_rails/client.rb, line 13
def send_message(options)
  RestClient::Request.execute(
    method: :post,
    url: surenotify_url,
    payload: JSON::dump(options),
    verify_ssl: verify_ssl,
    headers: {
      content_type: 'application/json',
            accept: 'application/json',
         x_api_key: @api_key
    }
  )
end
surenotify_url() click to toggle source
# File lib/surenotify_rails/client.rb, line 27
def surenotify_url
  api_url + "/messages"
end