class Eventick::Auth

Attributes

email[RW]
password[W]

Public Class Methods

new(&block) click to toggle source
# File lib/eventick/auth.rb, line 8
def initialize(&block)
  block.call self if block_given?
end

Public Instance Methods

authenticated?() click to toggle source
# File lib/eventick/auth.rb, line 16
def authenticated?
  !!@token
end
token() click to toggle source
# File lib/eventick/auth.rb, line 12
def token
  @token ||= (get)['token']
end

Private Instance Methods

get() click to toggle source
# File lib/eventick/auth.rb, line 21
def get
  @token = nil
  path = Eventick.api_path self.class.path
  method = Net::HTTP::Get.new(path)
  method.basic_auth @email, @password

  Eventick.request(method)
end