Class: Mobitex::Connection
- Inherits:
-
Object
- Object
- Mobitex::Connection
- Defined in:
- lib/mobitex/connection.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
Instance Method Summary collapse
-
#get(path, params = {}) ⇒ Object
Executes a GET request.
-
#initialize(endpoint) ⇒ Connection
constructor
A new instance of Connection.
-
#post(path, params = {}) ⇒ Object
Executes a POST request.
Constructor Details
#initialize(endpoint) ⇒ Connection
Returns a new instance of Connection.
9 10 11 12 13 |
# File 'lib/mobitex/connection.rb', line 9 def initialize(endpoint) raise ArgumentError, 'Missing endpoint URI' unless endpoint self.endpoint = endpoint end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
7 8 9 |
# File 'lib/mobitex/connection.rb', line 7 def endpoint @endpoint end |
Instance Method Details
#get(path, params = {}) ⇒ Object
Executes a GET request. Used to get (find) resources.
17 18 19 |
# File 'lib/mobitex/connection.rb', line 17 def get(path, params = {}) request(:get, path, params) end |
#post(path, params = {}) ⇒ Object
Executes a POST request. Used to create new resources.
23 24 25 |
# File 'lib/mobitex/connection.rb', line 23 def post(path, params = {}) request(:post, path, params) end |