Class: Barong::API

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

Overview

General barong API functions

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, app_id) ⇒ API

Returns a new instance of API.



6
7
8
9
# File 'lib/barong.rb', line 6

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

Instance Method Details

#log_in(email, password) ⇒ Object



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

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