class HabiticaClient::ApiBase

The basis of all HabiticaClient endpoint objects.

All HabiticaClient endpoint objects need a reference to the http client so that we can make the API work using the dot syntax.

Attributes

client[R]

Public Class Methods

endpoint(url) click to toggle source
# File lib/habitica_client/api_base.rb, line 23
def self.endpoint(url)
  instance_variable_set(:@endpoint, url)
end
new(client) click to toggle source
# File lib/habitica_client/api_base.rb, line 11
def initialize(client)
  @client = client
end

Public Instance Methods

data() click to toggle source
# File lib/habitica_client/api_base.rb, line 15
def data
  @data ||= client.class.get(endpoint)['data']
end
endpoint() click to toggle source
# File lib/habitica_client/api_base.rb, line 19
def endpoint
  self.class.instance_variable_get(:@endpoint)
end