class ContiamoEvent::Base

Constants

ENDPOINT

Public Instance Methods

connection() click to toggle source
# File lib/contiamo_event/base.rb, line 19
def connection
  conn = Faraday.new(url: endpoint) do |faraday|
    faraday.adapter Faraday.default_adapter
  end
end
endpoint() click to toggle source
# File lib/contiamo_event/base.rb, line 15
def endpoint
  ENDPOINT + "#{ContiamoEvent.configuration.token}/"
end
headers() click to toggle source
# File lib/contiamo_event/base.rb, line 8
def headers
  {
    'User-Agent'        => 'ContiamoEvent Ruby SDK',
    'Content-Type'      => 'application/json'
  }
end
post(action, args) click to toggle source
# File lib/contiamo_event/base.rb, line 25
def post(action, args)
  resp = connection.post do |req|
    req.url "#{action}"
    req.headers = headers
    req.body = args.to_json
  end
  [resp.status, resp.body]
end