Class: Fortenet::Client

Inherits:
Request show all
Defined in:
lib/fortenet/client.rb

Instance Method Summary collapse

Methods inherited from Request

#delete, #get, #parsed_response, #post, #put, #response

Constructor Details

#initialize(account_id = Fortenet.account_id, location_id = Fortenet.location_id, attrs = {}) ⇒ Client

Returns a new instance of Client.



4
5
6
7
# File 'lib/fortenet/client.rb', line 4

def initialize( = Fortenet., location_id = Fortenet.location_id, attrs = {})
  @location_id = location_id
  @account_id = 
end

Instance Method Details

#base_pathObject



9
10
11
# File 'lib/fortenet/client.rb', line 9

def base_path
  "/organizations/org_#{@account_id}/locations/loc_#{@location_id}/"
end

#create(relative_path, data = nil) ⇒ Object



17
18
19
# File 'lib/fortenet/client.rb', line 17

def create(relative_path, data = nil)
  self.post(base_path+relative_path, body: data_to_json(data))
end

#destroy(relative_path) ⇒ Object



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

def destroy(relative_path)
  self.delete(base_path+relative_path)
end

#find(relative_path, data = nil) ⇒ Object



13
14
15
# File 'lib/fortenet/client.rb', line 13

def find(relative_path, data = nil)
  self.get(base_path+relative_path, query: data)
end

#update(relative_path, data = nil) ⇒ Object



21
22
23
# File 'lib/fortenet/client.rb', line 21

def update(relative_path, data = nil)
  self.put(base_path+relative_path, body: data_to_json(data))
end