Class: Nestful::Connection
- Inherits:
-
Object
- Object
- Nestful::Connection
- Defined in:
- lib/nestful/connection.rb
Constant Summary collapse
- UriParser =
URI.const_defined?(:Parser) ? URI::Parser.new : URI
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#ssl_options ⇒ Object
Returns the value of attribute ssl_options.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #delete(path, headers = {}, &block) ⇒ Object
- #get(path, headers = {}, &block) ⇒ Object
- #head(path, headers = {}, &block) ⇒ Object
-
#initialize(endpoint, options = {}) ⇒ Connection
constructor
The
endpoint
parameter is required and will set theendpoint
attribute to the URI for the remote resource service. - #patch(path, body = '', headers = {}, &block) ⇒ Object
- #post(path, body = '', headers = {}, &block) ⇒ Object
- #put(path, body = '', headers = {}, &block) ⇒ Object
Constructor Details
#initialize(endpoint, options = {}) ⇒ Connection
The endpoint
parameter is required and will set the endpoint
attribute to the URI for the remote resource service.
13 14 15 16 17 18 19 |
# File 'lib/nestful/connection.rb', line 13 def initialize(endpoint, = {}) self.endpoint = endpoint .each do |key, value| self.send("#{key}=", value) unless value.nil? end end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
9 10 11 |
# File 'lib/nestful/connection.rb', line 9 def endpoint @endpoint end |
#proxy ⇒ Object
Returns the value of attribute proxy.
9 10 11 |
# File 'lib/nestful/connection.rb', line 9 def proxy @proxy end |
#ssl_options ⇒ Object
Returns the value of attribute ssl_options.
8 9 10 |
# File 'lib/nestful/connection.rb', line 8 def @ssl_options end |
#timeout ⇒ Object
Returns the value of attribute timeout.
8 9 10 |
# File 'lib/nestful/connection.rb', line 8 def timeout @timeout end |
Instance Method Details
#delete(path, headers = {}, &block) ⇒ Object
35 36 37 |
# File 'lib/nestful/connection.rb', line 35 def delete(path, headers = {}, &block) request(:delete, path, headers, &block) end |
#get(path, headers = {}, &block) ⇒ Object
31 32 33 |
# File 'lib/nestful/connection.rb', line 31 def get(path, headers = {}, &block) request(:get, path, headers, &block) end |
#head(path, headers = {}, &block) ⇒ Object
39 40 41 |
# File 'lib/nestful/connection.rb', line 39 def head(path, headers = {}, &block) request(:head, path, headers, &block) end |
#patch(path, body = '', headers = {}, &block) ⇒ Object
47 48 49 |
# File 'lib/nestful/connection.rb', line 47 def patch(path, body = '', headers = {}, &block) request(:patch, path, body, headers, &block) end |
#post(path, body = '', headers = {}, &block) ⇒ Object
51 52 53 |
# File 'lib/nestful/connection.rb', line 51 def post(path, body = '', headers = {}, &block) request(:post, path, body, headers, &block) end |
#put(path, body = '', headers = {}, &block) ⇒ Object
43 44 45 |
# File 'lib/nestful/connection.rb', line 43 def put(path, body = '', headers = {}, &block) request(:put, path, body, headers, &block) end |