Sha256: a699c178baa7b0dcc3ef32c3c48008e86961be1eb191028c7bd3709c9b89e61a

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 Bytes

Contents

module Flippa
  class Client
    URL = "https://api.flippa.com"

    attr_reader :last_response

    def initialize(access_token: nil)
      @access_token = access_token
    end

    def listings(options = {})
      @last_response = client.get "/v3/listings", options
      @last_response.body["data"].map do |listing|
        Listing.new(listing)
      end
    end

    private

    def client
      @client ||= Faraday.new(url: URL) do |conn|
        conn.response :json, content_type: /\bjson$/
        conn.adapter Faraday.default_adapter
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flippa-0.1.0 lib/flippa/client.rb