Sha256: f2b3524154902d0186651712d4964d1ef1bea2c988d49ecbdb78585694b5d52b

Contents?: true

Size: 531 Bytes

Versions: 15

Compression:

Stored size: 531 Bytes

Contents

dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require File.join(dir, 'httparty')
require 'pp'

class StackExchange
  include HTTParty
  base_uri 'api.stackexchange.com'

  def initialize(service, page)
    @options = { query: {site: service, page: page} }
  end

  def questions
    self.class.get("/2.2/questions", @options)
  end

  def users
    self.class.get("/2.2/users", @options)
  end
end

stack_exchange = StackExchange.new("stackoverflow", 1)
pp stack_exchange.questions
pp stack_exchange.users

Version data entries

15 entries across 14 versions & 5 rubygems

Version Path
httparty-0.14.0 examples/stackexchange.rb
simplenet-client-0.2.0 ./vendor/bundle/ruby/1.9.1/gems/httparty-0.13.7/examples/stackexchange.rb
simplenet-client-0.2.0 ./vendor/bundle/ruby/2.0.0/gems/httparty-0.13.7/examples/stackexchange.rb
httparty-0.13.7 examples/stackexchange.rb
httparty-0.13.6 examples/stackexchange.rb
httpserious-0.13.5.lstoll1 examples/stackexchange.rb
httparty-0.13.5 examples/stackexchange.rb
httparty-0.13.4 examples/stackexchange.rb
httsoiree-0.13.3 examples/stackexchange.rb
httparty-0.13.3 examples/stackexchange.rb
httparty-0.13.2 examples/stackexchange.rb
httsoiree-0.13.1.1 examples/stackexchange.rb
httsoiree-0.13.1 examples/stackexchange.rb
httparty-enterprise-edition-0.13.1.1 examples/stackexchange.rb
httparty-enterprise-edition-0.13.1 examples/stackexchange.rb