Class: Kentaa::Api::Resources::User
Instance Attribute Summary
Attributes inherited from Resource
#id
Attributes inherited from Base
#config, #endpoint_path, #options, #resource_class
Instance Method Summary
collapse
Methods inherited from Resource
#create, #created_at, #delete, #initialize, #load, #save, #updated_at
Methods inherited from Base
attribute_key, #initialize, #load, #loaded?
Instance Method Details
#address ⇒ Object
49
50
51
|
# File 'lib/kentaa/api/resources/user.rb', line 49
def address
data[:address]
end
|
#address2 ⇒ Object
53
54
55
|
# File 'lib/kentaa/api/resources/user.rb', line 53
def address2
data[:address2]
end
|
#avatar ⇒ Object
125
126
127
|
# File 'lib/kentaa/api/resources/user.rb', line 125
def avatar
@avatar ||= Kentaa::Api::Resources::Avatar.new(config, options: options.merge(endpoint_path: "/users/#{id}"))
end
|
#avatar_url ⇒ Object
45
46
47
|
# File 'lib/kentaa/api/resources/user.rb', line 45
def avatar_url
data[:avatar_url]
end
|
#birthday ⇒ Object
85
86
87
|
# File 'lib/kentaa/api/resources/user.rb', line 85
def birthday
Date.parse(data[:birthday]) if data[:birthday]
end
|
#city ⇒ Object
73
74
75
|
# File 'lib/kentaa/api/resources/user.rb', line 73
def city
data[:city]
end
|
#consent ⇒ Object
101
102
103
104
105
|
# File 'lib/kentaa/api/resources/user.rb', line 101
def consent
Kentaa::Api::Deprecation.warn('#consent is deprecated. Please use #consents instead.', caller)
@consent ||= Kentaa::Api::Resources::Consent.new(data[:consent]) if data[:consent]
end
|
#consents ⇒ Object
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/kentaa/api/resources/user.rb', line 107
def consents
@consents ||= begin
consents = []
if data[:consents]
data[:consents].each do |consent|
consents << Kentaa::Api::Resources::Consent.new(consent)
end
end
consents
end
end
|
#country ⇒ Object
77
78
79
|
# File 'lib/kentaa/api/resources/user.rb', line 77
def country
data[:country]
end
|
#email ⇒ Object
41
42
43
|
# File 'lib/kentaa/api/resources/user.rb', line 41
def email
data[:email]
end
|
#first_name ⇒ Object
25
26
27
|
# File 'lib/kentaa/api/resources/user.rb', line 25
def first_name
data[:first_name]
end
|
#gender ⇒ Object
89
90
91
|
# File 'lib/kentaa/api/resources/user.rb', line 89
def gender
data[:gender]
end
|
#house_number ⇒ Object
61
62
63
|
# File 'lib/kentaa/api/resources/user.rb', line 61
def house_number
data[:house_number]
end
|
#house_number_addition ⇒ Object
65
66
67
|
# File 'lib/kentaa/api/resources/user.rb', line 65
def house_number_addition
data[:house_number_addition]
end
|
#infix ⇒ Object
29
30
31
|
# File 'lib/kentaa/api/resources/user.rb', line 29
def infix
data[:infix]
end
|
#last_name ⇒ Object
33
34
35
|
# File 'lib/kentaa/api/resources/user.rb', line 33
def last_name
data[:last_name]
end
|
#locale ⇒ Object
93
94
95
|
# File 'lib/kentaa/api/resources/user.rb', line 93
def locale
data[:locale]
end
|
#name ⇒ Object
37
38
39
|
# File 'lib/kentaa/api/resources/user.rb', line 37
def name
[first_name, infix, last_name].reject { |s| s.to_s.empty? }.join(' ')
end
|
#object_key ⇒ Object
9
10
11
|
# File 'lib/kentaa/api/resources/user.rb', line 9
def object_key
"User_#{id}"
end
|
#phone ⇒ Object
81
82
83
|
# File 'lib/kentaa/api/resources/user.rb', line 81
def phone
data[:phone]
end
|
#public_id ⇒ Object
17
18
19
|
# File 'lib/kentaa/api/resources/user.rb', line 17
def public_id
data[:public_id]
end
|
#reset_password ⇒ Object
129
130
131
|
# File 'lib/kentaa/api/resources/user.rb', line 129
def reset_password
request.post("/users/#{id}/reset-password")
end
|
#security_activity ⇒ Object
97
98
99
|
# File 'lib/kentaa/api/resources/user.rb', line 97
def security_activity
@security_activity ||= Kentaa::Api::Resources::SecurityActivity.new(data[:security_activity]) if data[:security_activity]
end
|
#site ⇒ Object
13
14
15
|
# File 'lib/kentaa/api/resources/user.rb', line 13
def site
Kentaa::Api::Resources::Site.new(config, id: site_id, options: options)
end
|
#site_id ⇒ Object
21
22
23
|
# File 'lib/kentaa/api/resources/user.rb', line 21
def site_id
data[:site_id]
end
|
#street ⇒ Object
57
58
59
|
# File 'lib/kentaa/api/resources/user.rb', line 57
def street
data[:street]
end
|
#zipcode ⇒ Object
69
70
71
|
# File 'lib/kentaa/api/resources/user.rb', line 69
def zipcode
data[:zipcode]
end
|