Sha256: 76277573c3d42e96e8fb3556b06a960116c177255aa6f57e2207ba117bbded4f
Contents?: true
Size: 665 Bytes
Versions: 1
Compression:
Stored size: 665 Bytes
Contents
require 'byebug' module SPACEX class Response < Hashie::Mash disable_warnings end module BaseRequest def self.get(path) data = call_api(path) SPACEX::Response.new(data.get.body) end def self.retrieve_all(path) data = call_api(path) data.get.body.map { |k| [k] } end def self.call_api(path) Faraday.new( url: "#{SPACEX::ROOT_URI}/#{path}", request: { params_encoder: Faraday::FlatParamsEncoder } ) do |c| c.use ::FaradayMiddleware::ParseJson c.use Faraday::Response::RaiseError c.use Faraday::Adapter::NetHttp end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spacex-0.0.7 | lib/spacex/base_request.rb |