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 ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #[](suburl, options = {}) ⇒ Object
-
#initialize(url, options = {}) ⇒ Endpoint
constructor
A new instance of Endpoint.
- #request(options = {}) ⇒ Object
Constructor Details
#initialize(url, options = {}) ⇒ Endpoint
Returns a new instance of Endpoint.
9 10 11 12 |
# File 'lib/tickethub/endpoint.rb', line 9 def initialize(url, = {}) @url = url @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/tickethub/endpoint.rb', line 7 def @options end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/tickethub/endpoint.rb', line 7 def url @url end |
Instance Method Details
#[](suburl, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tickethub/endpoint.rb', line 14 def [](suburl, = {}) url = (if suburl.nil? then self.url else suburl = suburl.to_s base = self.url base += "/" unless base =~ /\/$/ URI.join(base, suburl).to_s end) self.class.new url, Tickethub::Helpers.deep_merge(@options, ) end |