Module: Signnow
- Defined in:
- lib/signnow.rb,
lib/signnow/base.rb,
lib/signnow/user.rb,
lib/signnow/client.rb,
lib/signnow/version.rb,
lib/signnow/document.rb,
lib/signnow/request/base.rb,
lib/signnow/request/info.rb,
lib/signnow/operations/all.rb,
lib/signnow/operations/find.rb,
lib/signnow/operations/show.rb,
lib/signnow/request/helpers.rb,
lib/signnow/operations/create.rb,
lib/signnow/operations/delete.rb,
lib/signnow/operations/update.rb,
lib/signnow/request/validator.rb,
lib/signnow/request/connection.rb,
lib/signnow/authentications/base.rb,
lib/signnow/authentications/oauth.rb,
lib/signnow/operations/download_link.rb
Defined Under Namespace
Modules: Authentications, Operations, Request Classes: APIError, AuthenticationError, Base, Client, Document, EmptyDocuments, InvalidToken, NotFound, SignnowError, User
Constant Summary collapse
- DOMAIN_BASE =
'api'- TEST_DOMAIN_BASE =
'capi-eval'- API_BASE =
'signnow.com'- API_BASE_PATH =
nil- TEST_API_BASE_PATH =
'api'- API_VERSION =
'v1'- ROOT_PATH =
File.dirname(__FILE__)
- VERSION =
'0.0.2'- @@configuration =
{}
Class Method Summary collapse
-
.base_path ⇒ Object
Returns the api base path depending on the env.
-
.configuration ⇒ Hash
Returns configuration hash.
-
.configure {|configuration| ... } ⇒ Object
Use thisfunciotn with a block to add app credentials configuration Example:.
-
.domain ⇒ Object
Returns the domain base of the api depending on the env.
-
.encoded_app_credentials ⇒ String
Returns the set api key.
-
.request(http_method, domain, api_url, data, options = {}) ⇒ Array
Makes a request against the Signnow API.
-
.uri ⇒ Object
Returns the api uri.
Class Method Details
.base_path ⇒ Object
Returns the api base path depending on the env
104 105 106 107 108 109 110 |
# File 'lib/signnow.rb', line 104 def self.base_path if configuration[:use_test_env?] TEST_API_BASE_PATH else API_BASE_PATH end end |
.configuration ⇒ Hash
Returns configuration hash
76 77 78 |
# File 'lib/signnow.rb', line 76 def self.configuration @@configuration end |
.configure {|configuration| ... } ⇒ Object
Use thisfunciotn with a block to add app credentials configuration Example:
Signnow.configure do |config|
config[:app_id] = 'your_app_id'
config[:app_secret] = 'your_app_secret'
end
69 70 71 72 |
# File 'lib/signnow.rb', line 69 def self.configure return unless block_given? yield(configuration) end |
.domain ⇒ Object
Returns the domain base of the api depending on the env
94 95 96 97 98 99 100 |
# File 'lib/signnow.rb', line 94 def self.domain if configuration[:use_test_env?] TEST_DOMAIN_BASE else DOMAIN_BASE end end |
.encoded_app_credentials ⇒ String
Returns the set api key
56 57 58 59 60 |
# File 'lib/signnow.rb', line 56 def self.encoded_app_credentials return unless configuration[:app_id] && configuration[:app_secret] configuration[:encoded_app_credentials] ||= Base64.strict_encode64("#{configuration[:app_id]}:#{configuration[:app_secret]}") end |
.request(http_method, domain, api_url, data, options = {}) ⇒ Array
Makes a request against the Signnow API
87 88 89 90 |
# File 'lib/signnow.rb', line 87 def self.request(http_method, domain, api_url, data, ={}) info = Request::Info.new(http_method, domain, api_url, data, ) Request::Base.new(info).perform end |
.uri ⇒ Object
Returns the api uri
114 115 116 117 118 |
# File 'lib/signnow.rb', line 114 def self.uri uri = "https://#{domain}" base_path && uri += "/#{base_path}" uri end |