Class: DocusignDtr::Client
- Inherits:
-
Object
- Object
- DocusignDtr::Client
- Includes:
- HTTParty
- Defined in:
- lib/docusign_dtr/client.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #base_uri ⇒ Object
-
#Document ⇒ Object
rubocop:disable Naming/MethodName.
- #get(page, params = {}) ⇒ Object
- #handle_error(response_code) ⇒ Object
-
#initialize(token:, test_mode: true, application: 'docusign_dtr') ⇒ Client
constructor
A new instance of Client.
-
#Member ⇒ Object
rubocop:disable Naming/MethodName.
-
#Meta ⇒ Object
rubocop:disable Naming/MethodName.
-
#Office ⇒ Object
rubocop:disable Naming/MethodName.
- #raw(page, params = {}) ⇒ Object
-
#Room ⇒ Object
rubocop:disable Naming/MethodName.
-
#Task ⇒ Object
rubocop:disable Naming/MethodName.
-
#TaskList ⇒ Object
rubocop:disable Naming/MethodName.
-
#Title ⇒ Object
rubocop:disable Naming/MethodName.
-
#User ⇒ Object
rubocop:disable Naming/MethodName.
Constructor Details
#initialize(token:, test_mode: true, application: 'docusign_dtr') ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 |
# File 'lib/docusign_dtr/client.rb', line 6 def initialize(token:, test_mode: true, application: 'docusign_dtr') @test_mode = test_mode @token = token @application = application raise 'Missing Token' unless token end |
Instance Attribute Details
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/docusign_dtr/client.rb', line 4 def token @token end |
Instance Method Details
#base_uri ⇒ Object
65 66 67 |
# File 'lib/docusign_dtr/client.rb', line 65 def base_uri @base_uri ||= @test_mode ? 'https://stage.cartavi.com/restapi/v1' : 'https://cartavi.com/restapi/v1' end |
#Document ⇒ Object
rubocop:disable Naming/MethodName
33 34 35 |
# File 'lib/docusign_dtr/client.rb', line 33 def Document # rubocop:disable Naming/MethodName @document ||= DocusignDtr::Document.new(client: self) # rubocop:disable Naming/MemoizedInstanceVariableName end |
#get(page, params = {}) ⇒ Object
13 14 15 16 |
# File 'lib/docusign_dtr/client.rb', line 13 def get(page, params = {}) response = raw(page, params) snakify(response) end |
#handle_error(response_code) ⇒ Object
25 26 27 |
# File 'lib/docusign_dtr/client.rb', line 25 def handle_error(response_code) raise error_type(response_code), "Error communicating: Response code #{response_code}" end |
#Member ⇒ Object
rubocop:disable Naming/MethodName
37 38 39 |
# File 'lib/docusign_dtr/client.rb', line 37 def Member # rubocop:disable Naming/MethodName @member ||= DocusignDtr::Member.new(client: self) # rubocop:disable Naming/MemoizedInstanceVariableName end |
#Meta ⇒ Object
rubocop:disable Naming/MethodName
41 42 43 |
# File 'lib/docusign_dtr/client.rb', line 41 def Meta # rubocop:disable Naming/MethodName @meta ||= DocusignDtr::Meta.new(client: self) # rubocop:disable Naming/MemoizedInstanceVariableName end |
#Office ⇒ Object
rubocop:disable Naming/MethodName
29 30 31 |
# File 'lib/docusign_dtr/client.rb', line 29 def Office # rubocop:disable Naming/MethodName @office ||= DocusignDtr::Office.new(client: self) # rubocop:disable Naming/MemoizedInstanceVariableName end |
#raw(page, params = {}) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/docusign_dtr/client.rb', line 18 def raw(page, params = {}) full_path = [base_uri, page].join response = self.class.get(full_path, query: params, headers: headers, timeout: 60) handle_error(response.code) if response.code != 200 response.parsed_response end |
#Room ⇒ Object
rubocop:disable Naming/MethodName
45 46 47 |
# File 'lib/docusign_dtr/client.rb', line 45 def Room # rubocop:disable Naming/MethodName @room ||= DocusignDtr::Room.new(client: self) # rubocop:disable Naming/MemoizedInstanceVariableName end |
#Task ⇒ Object
rubocop:disable Naming/MethodName
49 50 51 |
# File 'lib/docusign_dtr/client.rb', line 49 def Task # rubocop:disable Naming/MethodName @task ||= DocusignDtr::Task.new(client: self) # rubocop:disable Naming/MemoizedInstanceVariableName end |
#TaskList ⇒ Object
rubocop:disable Naming/MethodName
53 54 55 |
# File 'lib/docusign_dtr/client.rb', line 53 def TaskList # rubocop:disable Naming/MethodName @task_list ||= DocusignDtr::TaskList.new(client: self) # rubocop:disable Naming/MemoizedInstanceVariableName end |
#Title ⇒ Object
rubocop:disable Naming/MethodName
57 58 59 |
# File 'lib/docusign_dtr/client.rb', line 57 def Title # rubocop:disable Naming/MethodName @title ||= DocusignDtr::Title.new(client: self) # rubocop:disable Naming/MemoizedInstanceVariableName end |
#User ⇒ Object
rubocop:disable Naming/MethodName
61 62 63 |
# File 'lib/docusign_dtr/client.rb', line 61 def User # rubocop:disable Naming/MethodName @user ||= DocusignDtr::User.new(client: self) # rubocop:disable Naming/MemoizedInstanceVariableName end |