Module: Konstati

Defined in:
lib/konstati.rb,
lib/konstati/tests.rb,
lib/konstati/account.rb

Defined Under Namespace

Classes: Account, Tests

Constant Summary collapse

VERSION =
'0.2.0'

Class Method Summary collapse

Class Method Details

.apikeyObject



31
32
33
# File 'lib/konstati.rb', line 31

def self.apikey
    @apikey
end

.apikey=(val) ⇒ Object



27
28
29
# File 'lib/konstati.rb', line 27

def self.apikey=(val)
    @apikey = val
end

.endpointObject



11
12
13
# File 'lib/konstati.rb', line 11

def self.endpoint
    @endpoint ||= "https://api.konstati.co/v1"
end

.endpoint=(val) ⇒ Object



15
16
17
# File 'lib/konstati.rb', line 15

def self.endpoint=(val)
    @endpoint = val
end

.request(method, path, params = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/konstati.rb', line 39

def self.request(method, path, params = {})
    JSON.parse(
      RestClient::Request.execute(
        :method   => method,
        :url      => endpoint + path,
        :payload  => params,
        :user     => @username,
        :password => @apikey
      )
    )
end

.resource(path) ⇒ Object



35
36
37
# File 'lib/konstati.rb', line 35

def self.resource(path)
    RestClient::Resource.new(@endpoint + path, @username, @apikey)
end

.usernameObject



19
20
21
# File 'lib/konstati.rb', line 19

def self.username
    @username
end

.username=(val) ⇒ Object



23
24
25
# File 'lib/konstati.rb', line 23

def self.username=(val)
    @username = val
end