Class: Clicksign::Client
- Inherits:
-
Object
- Object
- Clicksign::Client
- Defined in:
- lib/clicksign/client.rb
Constant Summary collapse
- HEADERS =
{ 'Content-Type' => 'application/vnd.api+json', 'Accept' => 'application/vnd.api+json', }.freeze
Instance Method Summary collapse
- #delete(path, body: nil) ⇒ Object
- #get(path, params: {}) ⇒ Object
-
#initialize(api_key:, base_url:) ⇒ Client
constructor
A new instance of Client.
- #patch(path, body:) ⇒ Object
- #post(path, body:) ⇒ Object
Constructor Details
#initialize(api_key:, base_url:) ⇒ Client
Returns a new instance of Client.
14 15 16 17 |
# File 'lib/clicksign/client.rb', line 14 def initialize(api_key:, base_url:) @api_key = api_key @base_url = base_url end |
Instance Method Details
#delete(path, body: nil) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/clicksign/client.rb', line 38 def delete(path, body: nil) uri = build_uri(path) request = Net::HTTP::Delete.new(uri, headers) request.body = body.to_json if body execute(request, uri) end |
#get(path, params: {}) ⇒ Object
19 20 21 22 |
# File 'lib/clicksign/client.rb', line 19 def get(path, params: {}) uri = build_uri(path, params) execute(Net::HTTP::Get.new(uri, headers), uri) end |
#patch(path, body:) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/clicksign/client.rb', line 31 def patch(path, body:) uri = build_uri(path) request = Net::HTTP::Patch.new(uri, headers) request.body = body.to_json execute(request, uri) end |
#post(path, body:) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/clicksign/client.rb', line 24 def post(path, body:) uri = build_uri(path) request = Net::HTTP::Post.new(uri, headers) request.body = body.to_json execute(request, uri) end |