Class: Revolut::Api::Response::User
- Inherits:
-
Object
- Object
- Revolut::Api::Response::User
- Defined in:
- lib/revolut/api/response/user.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#birth_date ⇒ Object
Returns the value of attribute birth_date.
-
#created_date ⇒ Object
Returns the value of attribute created_date.
-
#email ⇒ Object
Returns the value of attribute email.
-
#email_verified ⇒ Object
Returns the value of attribute email_verified.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#kyc ⇒ Object
Returns the value of attribute kyc.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#referral_code ⇒ Object
Returns the value of attribute referral_code.
-
#risk_assessed ⇒ Object
Returns the value of attribute risk_assessed.
-
#state ⇒ Object
Returns the value of attribute state.
-
#terms_version ⇒ Object
Returns the value of attribute terms_version.
-
#under_review ⇒ Object
Returns the value of attribute under_review.
-
#wallet ⇒ Object
Returns the value of attribute wallet.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #in_state?(state) ⇒ Boolean
-
#initialize(hash = {}) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(hash = {}) ⇒ User
Returns a new instance of User.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/revolut/api/response/user.rb', line 14 def initialize(hash = {}) user_data = hash.fetch("user", {}) wallet_data = hash.fetch("wallet", {}) self.id = user_data.fetch("id", nil) self.created_date = user_data.fetch("createdDate", nil) self.created_date = ::Revolut::Api::Utilities.epoch_to_utc(self.created_date) unless self.created_date.nil? self.address = ::Revolut::Api::Response::Address.new(user_data.fetch("address", {})) self.birth_date = user_data.fetch("birthDate", nil) self.first_name = user_data.fetch("firstName", nil) self.last_name = user_data.fetch("lastName", nil) self.phone = user_data.fetch("phone", nil) self.email = user_data.fetch("email", nil) self.email_verified = user_data.fetch("emailVerified", false) self.state = user_data.fetch("state", nil) self.referral_code = user_data.fetch("referralCode", nil) self.kyc = user_data.fetch("kyc", nil) self.terms_version = user_data.fetch("termsVersion", nil) self.under_review = user_data.fetch("underReview", false) self.risk_assessed = user_data.fetch("riskAssessed", false) self.locale = user_data.fetch("locale", nil) self.wallet = ::Revolut::Api::Response::Wallet.new(wallet_data) end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
7 8 9 |
# File 'lib/revolut/api/response/user.rb', line 7 def address @address end |
#birth_date ⇒ Object
Returns the value of attribute birth_date.
8 9 10 |
# File 'lib/revolut/api/response/user.rb', line 8 def birth_date @birth_date end |
#created_date ⇒ Object
Returns the value of attribute created_date.
6 7 8 |
# File 'lib/revolut/api/response/user.rb', line 6 def created_date @created_date end |
#email ⇒ Object
Returns the value of attribute email.
9 10 11 |
# File 'lib/revolut/api/response/user.rb', line 9 def email @email end |
#email_verified ⇒ Object
Returns the value of attribute email_verified.
9 10 11 |
# File 'lib/revolut/api/response/user.rb', line 9 def email_verified @email_verified end |
#first_name ⇒ Object
Returns the value of attribute first_name.
9 10 11 |
# File 'lib/revolut/api/response/user.rb', line 9 def first_name @first_name end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/revolut/api/response/user.rb', line 5 def id @id end |
#kyc ⇒ Object
Returns the value of attribute kyc.
10 11 12 |
# File 'lib/revolut/api/response/user.rb', line 10 def kyc @kyc end |
#last_name ⇒ Object
Returns the value of attribute last_name.
9 10 11 |
# File 'lib/revolut/api/response/user.rb', line 9 def last_name @last_name end |
#locale ⇒ Object
Returns the value of attribute locale.
11 12 13 |
# File 'lib/revolut/api/response/user.rb', line 11 def locale @locale end |
#phone ⇒ Object
Returns the value of attribute phone.
9 10 11 |
# File 'lib/revolut/api/response/user.rb', line 9 def phone @phone end |
#referral_code ⇒ Object
Returns the value of attribute referral_code.
10 11 12 |
# File 'lib/revolut/api/response/user.rb', line 10 def referral_code @referral_code end |
#risk_assessed ⇒ Object
Returns the value of attribute risk_assessed.
11 12 13 |
# File 'lib/revolut/api/response/user.rb', line 11 def risk_assessed @risk_assessed end |
#state ⇒ Object
Returns the value of attribute state.
10 11 12 |
# File 'lib/revolut/api/response/user.rb', line 10 def state @state end |
#terms_version ⇒ Object
Returns the value of attribute terms_version.
10 11 12 |
# File 'lib/revolut/api/response/user.rb', line 10 def terms_version @terms_version end |
#under_review ⇒ Object
Returns the value of attribute under_review.
11 12 13 |
# File 'lib/revolut/api/response/user.rb', line 11 def under_review @under_review end |
#wallet ⇒ Object
Returns the value of attribute wallet.
12 13 14 |
# File 'lib/revolut/api/response/user.rb', line 12 def wallet @wallet end |
Instance Method Details
#active? ⇒ Boolean
39 40 41 |
# File 'lib/revolut/api/response/user.rb', line 39 def active? in_state?(:active) end |
#in_state?(state) ⇒ Boolean
43 44 45 |
# File 'lib/revolut/api/response/user.rb', line 43 def in_state?(state) self.state.downcase.strip.to_sym.eql?(state) end |