Class: Signnow::Request::Info
- Inherits:
-
Object
- Object
- Signnow::Request::Info
- Defined in:
- lib/signnow/request/info.rb
Instance Attribute Summary collapse
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#authentication ⇒ Object
Returns the value of attribute authentication.
-
#base_path ⇒ Object
Returns the value of attribute base_path.
-
#data ⇒ Object
Returns the value of attribute data.
-
#http_method ⇒ Object
Returns the value of attribute http_method.
-
#options ⇒ Object
Returns the value of attribute options.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
Instance Method Summary collapse
-
#initialize(http_method, subdomain, api_url, data, options = {}) ⇒ Info
constructor
A new instance of Info.
- #path_with_params(path, params) ⇒ Object
- #url ⇒ Object
- #use_form_data? ⇒ Boolean
Constructor Details
#initialize(http_method, subdomain, api_url, data, options = {}) ⇒ Info
Returns a new instance of Info.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/signnow/request/info.rb', line 6 def initialize(http_method, subdomain, api_url, data, ={}) @http_method = http_method @subdomain = subdomain || Signnow.domain @api_url = api_url @data = data @base_path = Signnow.base_path @authentication = {} @authentication[:type] = .delete(:auth_type) @authentication[:token] = .delete(:auth_token) @options = end |
Instance Attribute Details
#api_url ⇒ Object
Returns the value of attribute api_url.
4 5 6 |
# File 'lib/signnow/request/info.rb', line 4 def api_url @api_url end |
#authentication ⇒ Object
Returns the value of attribute authentication.
4 5 6 |
# File 'lib/signnow/request/info.rb', line 4 def authentication @authentication end |
#base_path ⇒ Object
Returns the value of attribute base_path.
4 5 6 |
# File 'lib/signnow/request/info.rb', line 4 def base_path @base_path end |
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/signnow/request/info.rb', line 4 def data @data end |
#http_method ⇒ Object
Returns the value of attribute http_method.
4 5 6 |
# File 'lib/signnow/request/info.rb', line 4 def http_method @http_method end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/signnow/request/info.rb', line 4 def @options end |
#subdomain ⇒ Object
Returns the value of attribute subdomain.
4 5 6 |
# File 'lib/signnow/request/info.rb', line 4 def subdomain @subdomain end |
Instance Method Details
#path_with_params(path, params) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/signnow/request/info.rb', line 30 def path_with_params(path, params) unless params.empty? encoded_params = URI.encode_www_form(params) [path, encoded_params].join("?") else path end end |
#url ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/signnow/request/info.rb', line 18 def url url = '' url += "/#{base_path}" if base_path url += "/#{api_url}" if has_id? url += "/#{data[:id]}" data.delete(:id) end url end |
#use_form_data? ⇒ Boolean
39 40 41 |
# File 'lib/signnow/request/info.rb', line 39 def use_form_data? .fetch(:use_form_data, false) end |