Class: BigDoor::User
Class Method Summary
collapse
Instance Method Summary
collapse
app_key, included, #parse_out_classes, #perform_request, secret_key
Constructor Details
#initialize(params) ⇒ User
Returns a new instance of User.
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/big-door/user.rb', line 7
def initialize(params)
params.each_pair do |key, val|
self.class.class_eval do
next if self.instance_methods.include?(key)
self.instance_eval do
attr_accessor key
end
end
instance_variable_set("@#{key}", val)
end
end
|
Class Method Details
.all ⇒ Object
19
20
21
|
# File 'lib/big-door/user.rb', line 19
def self.all
perform_request('get', 'end_user')
end
|
.create(params) ⇒ Object
23
24
25
|
# File 'lib/big-door/user.rb', line 23
def self.create(params)
perform_request('post', 'end_user', params)
end
|
.find(login) ⇒ Object
27
28
29
|
# File 'lib/big-door/user.rb', line 27
def self.find(login)
perform_request('get', 'end_user', {:id => login})
end
|
Instance Method Details
#add_points(named_transaction_group, points) ⇒ Object
39
40
41
|
# File 'lib/big-door/user.rb', line 39
def add_points(named_transaction_group, points)
perform_request('post', "named_transaction_group/#{named_transaction_group.id}/execute", {:id => self.end_user_login, :amount => points})
end
|
#destroy ⇒ Object
31
32
33
|
# File 'lib/big-door/user.rb', line 31
def destroy
perform_request('delete', 'end_user', {:id => self.end_user_login})
end
|
#get_currency_balance(currency = nil) ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/big-door/user.rb', line 43
def get_currency_balance(currency=nil)
params = {}
params[:id] = currency.id.to_s unless currency.nil?
result = perform_request('get', "end_user/#{self.end_user_login}/currency_balance", params)
result = parse_out_classes(result)
result['currency'] = parse_out_classes(result['currency']) unless result.empty?
return result
end
|
#transaction ⇒ Object
35
36
37
|
# File 'lib/big-door/user.rb', line 35
def transaction
perform_request('get', "end_user/#{self.end_user_login}/transaction")
end
|