Class: Dm3::Api::Connection
- Inherits:
-
Object
- Object
- Dm3::Api::Connection
- Defined in:
- lib/dm3/api/connection.rb
Instance Attribute Summary collapse
-
#service_url ⇒ Object
readonly
Returns the value of attribute service_url.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token, service_url) ⇒ Connection
constructor
A new instance of Connection.
- #method_missing(method_name, *args, &block) ⇒ Object
- #use_ssl? ⇒ Boolean
Constructor Details
#initialize(token, service_url) ⇒ Connection
Returns a new instance of Connection.
4 5 6 7 |
# File 'lib/dm3/api/connection.rb', line 4 def initialize(token, service_url) @token = token @service_url = service_url end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/dm3/api/connection.rb', line 9 def method_missing(method_name, *args, &block) request_class = request_class_for_method(method_name) if request_class request_class.new(self, args.).perform else super end end |
Instance Attribute Details
#service_url ⇒ Object (readonly)
Returns the value of attribute service_url.
2 3 4 |
# File 'lib/dm3/api/connection.rb', line 2 def service_url @service_url end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
2 3 4 |
# File 'lib/dm3/api/connection.rb', line 2 def token @token end |
Instance Method Details
#use_ssl? ⇒ Boolean
18 19 20 |
# File 'lib/dm3/api/connection.rb', line 18 def use_ssl? service_uri.scheme == 'https' end |