Class: Tandarb::Client

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

Direct Known Subclasses

Datastream, Oauth, Storestat, User

Constant Summary collapse

BASE_URL =
"https://my.tanda.co/api/v2"

Instance Method Summary collapse

Instance Method Details

#delete(path:, token:) ⇒ Object



25
26
27
# File 'lib/tandarb/client.rb', line 25

def delete(path:, token:)
  HTTParty.delete(BASE_URL + path, :headers => headers(token))
end

#get(path, token) ⇒ Object



5
6
7
8
9
# File 'lib/tandarb/client.rb', line 5

def get(path, token)
  HTTParty.get(
    BASE_URL + path,
    :headers => headers(token)).parsed_response
end

#post(path, body, token) ⇒ Object



11
12
13
14
15
16
# File 'lib/tandarb/client.rb', line 11

def post(path, body, token)
  HTTParty.post(
    BASE_URL + path,
    :headers => headers(token),
    :query => body).parsed_response
end

#put(path:, body:, token:) ⇒ Object



18
19
20
21
22
23
# File 'lib/tandarb/client.rb', line 18

def put(path:, body:, token:)
  HTTParty.put(
    BASE_URL + path,
    :headers => headers(token),
    :query => body).parsed_response
end