Class: Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/loadlab/client.rb

Constant Summary collapse

BASE_URL =
'https://api.loadlab.co/v1'

Instance Method Summary collapse

Constructor Details

#initialize(api_token, path) ⇒ Resource

Returns a new instance of Resource.



6
7
8
9
10
11
12
# File 'lib/loadlab/client.rb', line 6

def initialize(api_token, path)
    @path = path
    @headers = {
        Authorization: "Token #{api_token}",
        Accept: 'application/json',
    }         
end

Instance Method Details

#getObject



14
15
16
# File 'lib/loadlab/client.rb', line 14

def get
    HTTParty.get(BASE_URL + @path, headers: @headers)
end