Class: Tickethub::Endpoint
- Inherits:
-
Object
- Object
- Tickethub::Endpoint
- Defined in:
- lib/tickethub/endpoint.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#url(params = {}) ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #[](*parts) ⇒ Object
- #_normalize_path(str) ⇒ Object
-
#initialize(url, options) ⇒ Endpoint
constructor
A new instance of Endpoint.
- #request(params, options) ⇒ Object
Constructor Details
#initialize(url, options) ⇒ Endpoint
Returns a new instance of Endpoint.
11 12 13 14 |
# File 'lib/tickethub/endpoint.rb', line 11 def initialize(url, ) @url = _normalize_path url @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/tickethub/endpoint.rb', line 9 def @options end |
#url(params = {}) ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/tickethub/endpoint.rb', line 9 def url @url end |
Instance Method Details
#[](*parts) ⇒ Object
16 17 18 19 |
# File 'lib/tickethub/endpoint.rb', line 16 def [](*parts) parts = parts.compact.map { |part| _normalize_path part.to_s } self.class.new URI.join(url, *parts).to_s, @options end |
#_normalize_path(str) ⇒ Object
36 37 38 |
# File 'lib/tickethub/endpoint.rb', line 36 def _normalize_path(str) str.match(/\/$/) ? str : "#{str}/" end |