Class: DCMClient::Connection
- Inherits:
-
Object
- Object
- DCMClient::Connection
- Defined in:
- lib/dcm_client/connection.rb
Instance Attribute Summary collapse
-
#api_root ⇒ Object
Returns the value of attribute api_root.
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #delete(href) ⇒ Object
-
#initialize(opts = {}) ⇒ Connection
constructor
A new instance of Connection.
- #post(href, body) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Connection
Returns a new instance of Connection.
20 21 22 23 24 25 |
# File 'lib/dcm_client/connection.rb', line 20 def initialize(opts={}) self.username = opts[:username] self.password = opts[:password] self.api_root = opts[:api_root] self.logger = opts[:logger] end |
Instance Attribute Details
#api_root ⇒ Object
Returns the value of attribute api_root.
3 4 5 |
# File 'lib/dcm_client/connection.rb', line 3 def api_root @api_root end |
#connection ⇒ Object
Returns the value of attribute connection.
3 4 5 |
# File 'lib/dcm_client/connection.rb', line 3 def connection @connection end |
#logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/dcm_client/connection.rb', line 3 def logger @logger end |
#password ⇒ Object
Returns the value of attribute password.
3 4 5 |
# File 'lib/dcm_client/connection.rb', line 3 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
3 4 5 |
# File 'lib/dcm_client/connection.rb', line 3 def username @username end |
Instance Method Details
#delete(href) ⇒ Object
14 15 16 17 18 |
# File 'lib/dcm_client/connection.rb', line 14 def delete(href) wrap do connection.delete("#{href}.json") end end |
#post(href, body) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/dcm_client/connection.rb', line 5 def post(href, body) wrap do connection.post do |req| req.url href req.body = body.to_json end end end |