Module: Leadlight::Service
- Extended by:
- Forwardable
- Defined in:
- lib/leadlight/service.rb
Instance Attribute Summary collapse
-
#service_options ⇒ Object
readonly
Returns the value of attribute service_options.
Instance Method Summary collapse
- #connection ⇒ Object
-
#get_representation!(*args, &block) ⇒ Object
Convenience method for a quick GET which submits, waits, raises on error, and yields the representation.
- #initialize(service_options = {}) ⇒ Object
- #root ⇒ Object
- #url ⇒ Object
Instance Attribute Details
#service_options ⇒ Object (readonly)
Returns the value of attribute service_options.
10 11 12 |
# File 'lib/leadlight/service.rb', line 10 def @service_options end |
Instance Method Details
#connection ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/leadlight/service.rb', line 35 def connection @connection ||= ConnectionBuilder.new do |cxn| cxn.url url cxn.service self cxn.common_stack common_connection_stack cxn.adapter http_adapter end.call end |
#get_representation!(*args, &block) ⇒ Object
Convenience method for a quick GET which submits, waits, raises on error, and yields the representation.
52 53 54 |
# File 'lib/leadlight/service.rb', line 52 def get_representation!(*args, &block) get(*args).raise_on_error.submit_and_wait(&block) end |
#initialize(service_options = {}) ⇒ Object
20 21 22 23 |
# File 'lib/leadlight/service.rb', line 20 def initialize(={}) @service_options = execute_hook(:on_init, self) end |
#root ⇒ Object
25 26 27 28 29 |
# File 'lib/leadlight/service.rb', line 25 def root get('/') do |r| return r end end |
#url ⇒ Object
31 32 33 |
# File 'lib/leadlight/service.rb', line 31 def url self.class.url end |