class Proz::Freelancer
Attributes
key[R]
uuid[R]
Public Class Methods
new(key:, uuid:)
click to toggle source
# File lib/proz/freelancer.rb, line 8 def initialize(key:, uuid:) @key = key @uuid = uuid end
Public Instance Methods
freelancer()
click to toggle source
# File lib/proz/freelancer.rb, line 13 def freelancer case when freelancer_response.has_key?('error') if freelancer_response['error'].eql?('invalid_api_key') raise 'Invalid API Key' else raise 'Invalid Request' end when freelancer_response.has_key?('error_messages') if freelancer_response['error_messages'][0].eql?('No freelancer was found with that UUID.') raise 'No freelancer was found with that UUID' else raise 'Invalid Request' end else freelancer_response['data'] end end
method_missing(name, *args, &block)
click to toggle source
Calls superclass method
# File lib/proz/freelancer.rb, line 32 def method_missing(name, *args, &block) freelancer.has_key?(name.to_s) ? freelancer[name.to_s] : super end
Private Instance Methods
freelancer_response()
click to toggle source
# File lib/proz/freelancer.rb, line 38 def freelancer_response @freelancer_response ||= self.class.get("/freelancer/#{uuid}", headers: { 'X-Proz-API-Key' => key}) end