Class: Kiik::Wallet::User
- Inherits:
-
Object
- Object
- Kiik::Wallet::User
- Defined in:
- lib/kiik/wallet/user.rb
Instance Method Summary collapse
- #create(options = {}, &block) ⇒ Object
- #create_creditcard(options = {}, &block) ⇒ Object
-
#initialize(client) ⇒ User
constructor
A new instance of User.
- #login(options = {}, &block) ⇒ Object
- #regenerate_token(options = {}, &block) ⇒ Object
- #set_password(options = {}, &block) ⇒ Object
Constructor Details
#initialize(client) ⇒ User
Returns a new instance of User.
5 6 7 8 9 |
# File 'lib/kiik/wallet/user.rb', line 5 def initialize(client) @client = client @base_uri = '/users' @card = Kiik::Wallet::Creditcard.new(client) end |
Instance Method Details
#create(options = {}, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/kiik/wallet/user.rb', line 11 def create(={},&block) params = { :user => { :email => [:email], :password => [:password], :external_id => [:id] } } @client.request(:post,@base_uri,request_params(params),&block) end |
#create_creditcard(options = {}, &block) ⇒ Object
53 54 55 |
# File 'lib/kiik/wallet/user.rb', line 53 def create_creditcard(={},&block) @card.create(,&block) end |
#login(options = {}, &block) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/kiik/wallet/user.rb', line 33 def login(={},&block) params = { :auth => { :external_id => [:id], :password => [:password] } } @client.request(:post, '/auth/login', params, &block ) end |
#regenerate_token(options = {}, &block) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/kiik/wallet/user.rb', line 43 def regenerate_token(={},&block) params = { :auth => { :external_id => [:id], :password => [:password] } } @client.request(:post, '/auth/regenerate_token', params, &block ) end |
#set_password(options = {}, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/kiik/wallet/user.rb', line 22 def set_password(={},&block) params = { :user => { :email => [:email], :password => [:password], :new_password => [:new_password] } } @client.request(:put,"#{@base_uri}/#{options[:id]}",request_params(params),&block) end |