Class: TableauServerClient::RequestUrl
- Inherits:
-
Object
- Object
- TableauServerClient::RequestUrl
- Defined in:
- lib/tableau_server_client/request_url.rb
Instance Attribute Summary collapse
-
#api_version ⇒ Object
readonly
Returns the value of attribute api_version.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url, api_version, path, params) ⇒ RequestUrl
constructor
A new instance of RequestUrl.
- #merge_params!(params) ⇒ Object
- #query_params ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(url, api_version, path, params) ⇒ RequestUrl
Returns a new instance of RequestUrl.
5 6 7 8 9 10 |
# File 'lib/tableau_server_client/request_url.rb', line 5 def initialize(url, api_version, path, params) @url = url @api_version = api_version @path = path @params = params end |
Instance Attribute Details
#api_version ⇒ Object (readonly)
Returns the value of attribute api_version.
12 13 14 |
# File 'lib/tableau_server_client/request_url.rb', line 12 def api_version @api_version end |
#params ⇒ Object
Returns the value of attribute params.
13 14 15 |
# File 'lib/tableau_server_client/request_url.rb', line 13 def params @params end |
#path ⇒ Object
Returns the value of attribute path.
13 14 15 |
# File 'lib/tableau_server_client/request_url.rb', line 13 def path @path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
12 13 14 |
# File 'lib/tableau_server_client/request_url.rb', line 12 def url @url end |
Instance Method Details
#merge_params!(params) ⇒ Object
15 16 17 18 |
# File 'lib/tableau_server_client/request_url.rb', line 15 def merge_params!(params) @params.merge!(params) self end |
#query_params ⇒ Object
24 25 26 27 |
# File 'lib/tableau_server_client/request_url.rb', line 24 def query_params return "" if params.empty? params.keys.map {|k| URI.encode("#{k}=#{params[k]}") }.join("&") end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/tableau_server_client/request_url.rb', line 20 def to_s URI("#{url}/api/#{api_version}/#{path}?#{query_params}").to_s end |