Sha256: 111a37440c3d3d62c481b1c34d7a19dbf836552610b7787eb4ec12cbc9b0cfd0

Contents?: true

Size: 395 Bytes

Versions: 2

Compression:

Stored size: 395 Bytes

Contents

require 'pp'
module Telegraph
  module Core
    def self.request(method, params = {})
      conn = Faraday.new(
          :url => 'https://api.telegra.ph',
          request: { params_encoder: Faraday::FlatParamsEncoder }
      )
      conn.response :json

      response = conn.get('/' + method) do |request|
        request.params.merge!(params)
      end
      response.body
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
telegraph_api-0.1.1 lib/telegraph/api/core.rb
telegraph_api-0.1.0 lib/telegraph/api/core.rb