Class: Client

Inherits:
Object
  • Object
show all
Defined in:
lib/wattics-api-client/client.rb

Instance Method Summary collapse

Instance Method Details

#send(measurement, config) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/wattics-api-client/client.rb', line 4

def send(measurement, config)
  response = RestClient::Request.execute(method: :post, url: config.uri,
                                         user: config.username, password: config.password,
                                         payload: measurement.json)
  return response
rescue RestClient::ExceptionWithResponse => e
  return  e.response
end