Class: SynapsePay::User

Inherits:
APIResource show all
Defined in:
lib/synapse_pay/resources/user.rb

Instance Attribute Summary collapse

Attributes inherited from APIResource

#api_method, #client, #json

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIResource

api_attribute_names, #api_attributes, api_subclass_fetch, api_subclasses, #changed_api_attributes, #clear_api_attributes, #determine_api_attribute_value, determine_api_attribute_value, #initialize, #inspect, #inspect_api_attributes, #inspect_nested, #refresh_from, register_api_subclass, #to_json

Constructor Details

This class inherits a constructor from SynapsePay::APIResource

Instance Attribute Details

#accept_bank_paymentsObject

Returns the value of attribute accept_bank_payments.



3
4
5
# File 'lib/synapse_pay/resources/user.rb', line 3

def accept_bank_payments
  @accept_bank_payments
end

#accept_gratuityObject

Returns the value of attribute accept_gratuity.



4
5
6
# File 'lib/synapse_pay/resources/user.rb', line 4

def accept_gratuity
  @accept_gratuity
end

#avatarObject

Returns the value of attribute avatar.



5
6
7
# File 'lib/synapse_pay/resources/user.rb', line 5

def avatar
  @avatar
end

#balanceObject

Returns the value of attribute balance.



6
7
8
# File 'lib/synapse_pay/resources/user.rb', line 6

def balance
  @balance
end

#emailObject

Returns the value of attribute email.



7
8
9
# File 'lib/synapse_pay/resources/user.rb', line 7

def email
  @email
end

#fullnameObject

Returns the value of attribute fullname.



8
9
10
# File 'lib/synapse_pay/resources/user.rb', line 8

def fullname
  @fullname
end

#has_avatarObject

Returns the value of attribute has_avatar.



9
10
11
# File 'lib/synapse_pay/resources/user.rb', line 9

def has_avatar
  @has_avatar
end

#is_trustedObject

Returns the value of attribute is_trusted.



10
11
12
# File 'lib/synapse_pay/resources/user.rb', line 10

def is_trusted
  @is_trusted
end

#phone_numberObject

Returns the value of attribute phone_number.



11
12
13
# File 'lib/synapse_pay/resources/user.rb', line 11

def phone_number
  @phone_number
end

#promo_textObject

Returns the value of attribute promo_text.



12
13
14
# File 'lib/synapse_pay/resources/user.rb', line 12

def promo_text
  @promo_text
end

#referral_codeObject

Returns the value of attribute referral_code.



13
14
15
# File 'lib/synapse_pay/resources/user.rb', line 13

def referral_code
  @referral_code
end

#resource_uriObject

Returns the value of attribute resource_uri.



14
15
16
# File 'lib/synapse_pay/resources/user.rb', line 14

def resource_uri
  @resource_uri
end

#seller_detailsObject

Returns the value of attribute seller_details.



15
16
17
# File 'lib/synapse_pay/resources/user.rb', line 15

def seller_details
  @seller_details
end

#user_idObject

Returns the value of attribute user_id.



16
17
18
# File 'lib/synapse_pay/resources/user.rb', line 16

def user_id
  @user_id
end

#usernameObject

Returns the value of attribute username.



17
18
19
# File 'lib/synapse_pay/resources/user.rb', line 17

def username
  @username
end

#visit_countObject

Returns the value of attribute visit_count.



18
19
20
# File 'lib/synapse_pay/resources/user.rb', line 18

def visit_count
  @visit_count
end

#visit_messageObject

Returns the value of attribute visit_message.



19
20
21
# File 'lib/synapse_pay/resources/user.rb', line 19

def visit_message
  @visit_message
end

Class Method Details

.create(params = {}, headers = {}) ⇒ Object



21
22
23
24
25
# File 'lib/synapse_pay/resources/user.rb', line 21

def self.create(params={}, headers={})
  method = APIMethod.new(:post, "/user/create", params, headers, self)
  json = method.execute
  Client.new().refresh_from(json)
end

.login(username, password, params = {}, headers = {}) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/synapse_pay/resources/user.rb', line 27

def self.(username, password, params={}, headers={})
  params = ParamsBuilder.merge({
    :username => username,
    :password => password,
  }, params)
  method = APIMethod.new(:post, "/user/login", params, headers, self)
  json = method.execute
  Client.new().refresh_from(json)
end

.refresh_access(refresh_token, params = {}, headers = {}) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/synapse_pay/resources/user.rb', line 37

def self.refresh_access(refresh_token, params={}, headers={})
  params = ParamsBuilder.merge({
    :refresh_token => refresh_token,
  }, params)
  method = APIMethod.new(:post, "/user/refresh", params, headers, self)
  json = method.execute
  Client.new().refresh_from(json)
end

Instance Method Details

#refresh(params = {}, headers = {}) ⇒ Object



46
47
48
49
50
# File 'lib/synapse_pay/resources/user.rb', line 46

def refresh(params={}, headers={})
  method = APIMethod.new(:post, "/user/show", params, headers, self)
  json = @client.execute(method)
  self.refresh_from(json[:user], method)
end

#update(params = {}, headers = {}) ⇒ Object



52
53
54
55
56
# File 'lib/synapse_pay/resources/user.rb', line 52

def update(params={}, headers={})
  method = APIMethod.new(:post, "/user/edit", params, headers, self)
  json = @client.execute(method)
  self.refresh_from(json[:user], method)
end