Class: Fortenet::Client
Instance Attribute Summary
Attributes inherited from Request
#response
Instance Method Summary
collapse
Methods inherited from Request
#delete, #get, #parsed_response, #post, #put
Constructor Details
#initialize(account_id = Fortenet.account_id, location_id = Fortenet.location_id) ⇒ Client
Returns a new instance of Client.
3
4
5
|
# File 'lib/fortenet/client.rb', line 3
def initialize(account_id = Fortenet.account_id, location_id = Fortenet.location_id)
self.base_path = "/organizations/org_#{account_id}/locations/loc_#{location_id}/"
end
|
Instance Method Details
#create(relative_path, data = nil) ⇒ Object
11
12
13
|
# File 'lib/fortenet/client.rb', line 11
def create(relative_path, data = nil)
post(base_path + relative_path, body: data_to_json(data))
end
|
#destroy(relative_path) ⇒ Object
19
20
21
|
# File 'lib/fortenet/client.rb', line 19
def destroy(relative_path)
delete(base_path + relative_path)
end
|
#find(relative_path, data = nil) ⇒ Object
7
8
9
|
# File 'lib/fortenet/client.rb', line 7
def find(relative_path, data = nil)
get(base_path + relative_path, query: data)
end
|
#update(relative_path, data = nil) ⇒ Object
15
16
17
|
# File 'lib/fortenet/client.rb', line 15
def update(relative_path, data = nil)
put(base_path + relative_path, body: data_to_json(data))
end
|