Class: Blockmason::Link::Project
- Inherits:
-
Object
- Object
- Blockmason::Link::Project
- Defined in:
- lib/blockmason/link/project.rb
Overview
The entry-point for most apps to integrate with a Blockmason Link project.
Instance Method Summary collapse
-
#get(path, inputs = {}) ⇒ Object
Performs a GET request against a Link project’s API at the given
path
and with the given optionalinputs
. -
#initialize(base_url: ::Blockmason::Link::Provider.default_url, client_id:, client_secret:) ⇒ Project
constructor
Initialize a Project with your Link project’s
client_id
andclient_secret
. -
#post(path, inputs = {}) ⇒ Object
Performs a POST request against a Link project’s API at the given
path
and with the given optionalinputs
.
Constructor Details
#initialize(base_url: ::Blockmason::Link::Provider.default_url, client_id:, client_secret:) ⇒ Project
Initialize a Project with your Link project’s client_id
and client_secret
. Optionally, you can provide an alternative base_url
here. For example, if mocking server responses for an integration test suite, or if using a Link-compatible API provider.
13 14 15 16 17 |
# File 'lib/blockmason/link/project.rb', line 13 def initialize(base_url: ::Blockmason::Link::Provider.default_url, client_id:, client_secret:) @base_url = base_url @client_id = client_id @client_secret = client_secret end |
Instance Method Details
#get(path, inputs = {}) ⇒ Object
Performs a GET request against a Link project’s API at the given path
and with the given optional inputs
. Returns the outputs returned for the API call.
23 24 25 |
# File 'lib/blockmason/link/project.rb', line 23 def get(path, inputs = {}) session.get(path, inputs) end |
#post(path, inputs = {}) ⇒ Object
Performs a POST request against a Link project’s API at the given path
and with the given optional inputs
. Returns the outputs returned for the API call.
31 32 33 |
# File 'lib/blockmason/link/project.rb', line 31 def post(path, inputs = {}) session.post(path, inputs) end |