Class: ApiController::Barong

Inherits:
Object
  • Object
show all
Defined in:
lib/ApiController/barong.rb

Overview

General barong API functions

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, app_id) ⇒ Barong

Returns a new instance of Barong.



8
9
10
11
# File 'lib/ApiController/barong.rb', line 8

def initialize(endpoint, app_id)
  @endpoint = endpoint
  @app_id = app_id
end

Instance Method Details

#log_in(email, password) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ApiController/barong.rb', line 13

def (email, password)
  response = RestClient.post("#{@endpoint}/sessions",
                             {
                              'email': email,
                              'password': password,
                              'application_id': @app_id,
                              'expires_in': 80_000
                             },
                             {
                                 'content_type': 'application/x-www-form-urlencoded'
                             })
  response.delete('"')
end