Class: Bankin::User
Constant Summary
collapse
- RESOURCE_PATH =
'/v2/users'
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Resource
auth_delegate, collections, #collections, #fields, fields, has_collection, has_fields, has_resource, #initialize, resources, #resources
Instance Attribute Details
#token ⇒ Object
Returns the value of attribute token.
3
4
5
|
# File 'lib/bankin/resources/user.rb', line 3
def token
@token
end
|
Class Method Details
.authenticate(email, password) ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/bankin/resources/user.rb', line 49
def self.authenticate(email, password)
response = Bankin.api_call(:post, '/v2/authenticate',
{ email: email, password: password })
user = new(response['user'])
user.token = response['access_token']
user
end
|
.create(email, password) ⇒ Object
43
44
45
46
47
|
# File 'lib/bankin/resources/user.rb', line 43
def self.create(email, password)
response = Bankin.api_call(:post, RESOURCE_PATH,
{ email: email, password: password })
new(response)
end
|
.list(options = {}) ⇒ Object
Instance Method Details
#add_item_url(redirect_url = nil, params = {}) ⇒ Object
21
22
23
24
|
# File 'lib/bankin/resources/user.rb', line 21
def add_item_url(redirect_url = nil, params = {})
authenticate if token.nil?
Item.add_url(token, redirect_url, params)
end
|
#delete(password) ⇒ Object
17
18
19
|
# File 'lib/bankin/resources/user.rb', line 17
def delete(password)
Bankin.api_call(:delete, resource_uri, { password: password })
end
|
#item_connect_url(bank_id, redirect_url = nil) ⇒ Object
26
27
28
|
# File 'lib/bankin/resources/user.rb', line 26
def item_connect_url(bank_id, redirect_url = nil)
Item.connect_url(token, bank_id, redirect_url)
end
|
#pro_confirmation_url ⇒ Object