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