Sha256: 725470b9a7db66fdea0d025c7ba67f674e3a79e60a438008feed72195d68b2fa

Contents?: true

Size: 451 Bytes

Versions: 2

Compression:

Stored size: 451 Bytes

Contents

# frozen_string_literal: true

module SPACEX
  module BaseRequest
    def self.get(path)
      data = 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
      Hashie::Mash.new(data.get.body)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spacex-0.0.6 lib/spacex/base_request.rb
spacex-0.0.5 lib/spacex/base_request.rb