Class: Proz::Profile
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token:) ⇒ Profile
constructor
A new instance of Profile.
- #method_missing(name, *args, &block) ⇒ Object
- #profile ⇒ Object
Constructor Details
#initialize(token:) ⇒ Profile
Returns a new instance of Profile.
8 9 10 |
# File 'lib/proz/profile.rb', line 8 def initialize(token:) @token = token end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
27 28 29 |
# File 'lib/proz/profile.rb', line 27 def method_missing(name, *args, &block) profile.has_key?(name.to_s) ? profile[name.to_s] : super end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/proz/profile.rb', line 7 def token @token end |
Instance Method Details
#profile ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/proz/profile.rb', line 12 def profile case when profile_response.has_key?('error') if profile_response['error'].eql?('invalid_token') raise 'Invalid Token' elsif profile_response['error'].eql?('expired_token') raise 'Access Token Expired' else raise 'Invalid Request' end else profile_response['data'] end end |