class Proz::Profile
Attributes
token[R]
Public Class Methods
new(token:)
click to toggle source
# File lib/proz/profile.rb, line 8 def initialize(token:) @token = token end
Public Instance Methods
method_missing(name, *args, &block)
click to toggle source
Calls superclass method
# 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
profile()
click to toggle source
# 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
Private Instance Methods
profile_response()
click to toggle source
# File lib/proz/profile.rb, line 33 def profile_response @profile ||= self.class.get("/freelancer/me", headers: { 'Authorization' => "Bearer #{token}" }) end