Class: Qualityforward::Client

Inherits:
Object
  • Object
show all
Includes:
Qualityforward
Defined in:
lib/qualityforward/client.rb

Constant Summary

Constants included from Qualityforward

VERSION

Instance Method Summary collapse

Methods included from Qualityforward

#method_missing

Constructor Details

#initialize(api_key = nil) ⇒ Client

Returns a new instance of Client.



7
8
9
# File 'lib/qualityforward/client.rb', line 7

def initialize(api_key = nil)
  @@api_key = api_key unless nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Qualityforward

Instance Method Details

#get(path) ⇒ Object



15
16
17
18
# File 'lib/qualityforward/client.rb', line 15

def get path
  res = Faraday.get url(path)
  JSON.parse res.body
end

#url(path) ⇒ Object



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

def url path
  return "#{@@url}#{path}?api_key=#{@@api_key}"
end