lib/openbd/client.rb in openbd_api-0.4.2 vs lib/openbd/client.rb in openbd_api-0.4.3
- old
+ new
@@ -12,11 +12,11 @@
response_class: ::OpenBD::Responses::Get
)
end
def bulk_get(isbns)
- get_request(
+ post_request(
method: PATH_TO_GET,
params: { isbn: normalize_isbns(isbns) },
response_class: ::OpenBD::Responses::Get
)
end
@@ -47,14 +47,15 @@
def get_request(method:, params:, response_class:)
faraday_response = connection.get(method, params)
response_class.new(faraday_response)
end
- def post_request(method, params)
+ def post_request(method:, params:, response_class:)
faraday_response = connection.post do |req|
req.url method
req.body = "isbn=#{normalize_isbns(params[:isbn])}"
end
+ response_class.new(faraday_response)
end
def normalize_isbns(isbns)
case isbns
when String