Class: Esignatur::Api
- Inherits:
-
Object
- Object
- Esignatur::Api
- Defined in:
- lib/esignatur/api.rb,
lib/esignatur/api/response.rb,
lib/esignatur/api/request_info.rb
Overview
all raw http requests are made using Api instance
Defined Under Namespace
Classes: RequestInfo, Response
Constant Summary collapse
- DEFAULT_BASE_URL =
'https://api.esignatur.dk'
Instance Attribute Summary collapse
-
#creator_id ⇒ Object
readonly
Returns the value of attribute creator_id.
Instance Method Summary collapse
- #get(relative_url, headers: {}, timeout: nil) ⇒ Object
-
#initialize(api_key:, creator_id:, base_url: DEFAULT_BASE_URL, timeout: nil) ⇒ Api
constructor
A new instance of Api.
- #post(relative_url, data:, headers: {}, timeout: nil) ⇒ Object
Constructor Details
#initialize(api_key:, creator_id:, base_url: DEFAULT_BASE_URL, timeout: nil) ⇒ Api
Returns a new instance of Api.
15 16 17 18 19 20 |
# File 'lib/esignatur/api.rb', line 15 def initialize(api_key:, creator_id:, base_url: DEFAULT_BASE_URL, timeout: nil) @api_key = api_key.to_s @base_url = base_url @creator_id = creator_id @default_timeout = timeout end |
Instance Attribute Details
#creator_id ⇒ Object (readonly)
Returns the value of attribute creator_id.
13 14 15 |
# File 'lib/esignatur/api.rb', line 13 def creator_id @creator_id end |
Instance Method Details
#get(relative_url, headers: {}, timeout: nil) ⇒ Object
26 27 28 |
# File 'lib/esignatur/api.rb', line 26 def get(relative_url, headers: {}, timeout: nil) make_request(:get, relative_url, extra_headers: headers, timeout: timeout) end |
#post(relative_url, data:, headers: {}, timeout: nil) ⇒ Object
22 23 24 |
# File 'lib/esignatur/api.rb', line 22 def post(relative_url, data:, headers: {}, timeout: nil) make_request(:post, relative_url, data: data, extra_headers: headers, timeout: timeout) end |