Class: BridgeInteractive::Bridge::Office
- Inherits:
-
Object
- Object
- BridgeInteractive::Bridge::Office
- Defined in:
- lib/bridge_interactive/bridge/office.rb
Constant Summary collapse
- BASE_URL =
'https://api.bridgedataoutput.com/api/v2/'
Instance Method Summary collapse
-
#all(dataset_id, filters = {}) ⇒ Object
Fetch all offices from the specified dataset.
-
#find(dataset_id, office_id) ⇒ Object
Fetch a specific office by their office ID.
-
#initialize(client, server_token) ⇒ Office
constructor
A new instance of Office.
Constructor Details
#initialize(client, server_token) ⇒ Office
Returns a new instance of Office.
6 7 8 9 |
# File 'lib/bridge_interactive/bridge/office.rb', line 6 def initialize(client, server_token) @client = client @server_token = server_token end |
Instance Method Details
#all(dataset_id, filters = {}) ⇒ Object
Fetch all offices from the specified dataset
12 13 14 15 16 |
# File 'lib/bridge_interactive/bridge/office.rb', line 12 def all(dataset_id, filters = {}) endpoint = "#{BASE_URL}#{dataset_id}/offices" response = @client.get(endpoint, filters.merge(access_token: @server_token)) handle_response(response) end |
#find(dataset_id, office_id) ⇒ Object
Fetch a specific office by their office ID
19 20 21 22 23 |
# File 'lib/bridge_interactive/bridge/office.rb', line 19 def find(dataset_id, office_id) endpoint = "#{BASE_URL}#{dataset_id}/offices/#{office_id}" response = @client.get(endpoint, { access_token: @server_token }) handle_response(response) end |