class Spartacus

Public Class Methods

new(email, password, api_base_path="https://www.bloc.io/api/v1") click to toggle source
# File lib/spartacus.rb, line 30
def initialize(email, password, api_base_path="https://www.bloc.io/api/v1")
  @api_base_path = api_base_path
  url = "#{@api_base_path}/sessions"

  response = self.class.post(url, body: { email: email, password: password })

  if success?(response.code)
    response_hash = JSON.parse(response.body)
    @auth_token =  response_hash["auth_token"]
  else
    raise response.body
  end
end