Sha256: 8131c68020bcbbdce2ff729b021e11151596944ef87b8f280ff4a544a4224a56

Contents?: true

Size: 476 Bytes

Versions: 1

Compression:

Stored size: 476 Bytes

Contents

require "api_client/version"
require "net/http"

module ApiClient
  autoload :Exceptions, 'api_client/exceptions'

  def self.get(url = '')
    response = Net::HTTP.get_response(URI.parse(url))
    raise ApiClient::Exceptions::NotFound if response.code == '404'
    response.body
  end

  def self.post(url = '', args = {})
    response = Net::HTTP.post_form(URI.parse(url), args)
    raise ApiClient::Exceptions::NotFound if response.code == '404'
    response.body
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
api-client-0.2.0 lib/api_client.rb