Class: Mobitex::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/mobitex/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint) ⇒ Connection

Returns a new instance of Connection.

Raises:

  • (ArgumentError)


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

#endpointObject

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