Class: BigDoor::User
Class Method Summary
collapse
Instance Method Summary
collapse
app_key, included, #parse_out_classes, #perform_request, #remote_id, 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_award(named_award_id) ⇒ Object
55
56
57
|
# File 'lib/big-door/user.rb', line 55
def add_award(named_award_id)
perform_request('post', "end_user/#{self.end_user_login}/award", {}, {:named_award_id => named_award_id})
end
|
#add_level(named_level_id) ⇒ Object
47
48
49
|
# File 'lib/big-door/user.rb', line 47
def add_level(named_level_id)
perform_request('post', "end_user/#{self.end_user_login}/level", {}, {:named_level_id => named_level_id})
end
|
#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
|
#award ⇒ Object
51
52
53
|
# File 'lib/big-door/user.rb', line 51
def award
perform_request('get', "end_user/#{self.end_user_login}/award")
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
59
60
61
62
63
64
65
66
67
|
# File 'lib/big-door/user.rb', line 59
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
|
#level ⇒ Object
43
44
45
|
# File 'lib/big-door/user.rb', line 43
def level
perform_request('get', "end_user/#{self.end_user_login}/level")
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
|