Class: Atum::Core::Link
- Inherits:
-
Object
- Object
- Atum::Core::Link
- Defined in:
- lib/atum/core/link.rb
Overview
A link invokes requests with an HTTP server.
Constant Summary collapse
- LIMIT_INCREMENT =
The amount limit is increased on each successive fetch in pagination
50
Instance Method Summary collapse
-
#initialize(url, link_schema, options = {}) ⇒ Link
constructor
Instantiate a link.
-
#run(*parameters) ⇒ String, ...
Make a request to the server.
Constructor Details
#initialize(url, link_schema, options = {}) ⇒ Link
Instantiate a link.
21 22 23 24 25 26 |
# File 'lib/atum/core/link.rb', line 21 def initialize(url, link_schema, = {}) root_url, @path_prefix = unpack_url(url) @connection = Faraday.new(url: root_url) @link_schema = link_schema @headers = [:default_headers] || {} end |
Instance Method Details
#run(*parameters) ⇒ String, ...
Make a request to the server.
37 38 39 40 41 42 43 44 |
# File 'lib/atum/core/link.rb', line 37 def run(*parameters) = parameters.pop raise ArgumentError, 'options must be a hash' unless .is_a?(Hash) = .deep_merge() path = build_path(*parameters) Request.new(@connection, @link_schema.method, path, ).request end |