lib/hphones/endpoint.rb in hphones-ruby-0.0.1 vs lib/hphones/endpoint.rb in hphones-ruby-0.0.2
- old
+ new
@@ -9,11 +9,11 @@
#
class Endpoint
class MissingParameterError < StandardError; end
# The path to the endpoints file.
- ENDPOINTS_PATH = File.join('data', 'endpoints.yml')
+ ENDPOINTS_PATH = File.join(File.dirname(__FILE__), '..', '..', 'data', 'endpoints.yml')
class << self
def lookup(key)
!endpoints[key.to_s].nil?
end
@@ -35,11 +35,15 @@
@params = Hashie::Mash.new params
end
def fetch
api_params = compile_params
- req = Hphones::Request.new(api)
+ req = Hphones::Request.new(api, self)
req.send endpoint_info['method'], api_params
+ end
+
+ def response_type
+ endpoint_info['response']
end
private
attr_reader :key, :api, :params