Sha256: 1b5ff492070892837f8faf6825132a763804a925054b0af826fd47af2787f5b0

Contents?: true

Size: 558 Bytes

Versions: 2

Compression:

Stored size: 558 Bytes

Contents

require 'rest-core'

AsynchronousClient = RestCore::Builder.client do
  s = self.class # this is only for ruby 1.8!
  use s::DefaultSite , 'https://api.github.com/users/'
  use s::JsonDecode  , true
  use s::CommonLogger, method(:puts)
  use s::Cache       , nil, 3600
  run s::EmHttpRequest
end

client = AsynchronousClient.new
EM.run{
  client.get('cardinalblue'){ |response|
    p response
    EM.stop
  }
  puts "It's not blocking..."
}

puts

EM.run{
  Fiber.new{
    p client.get('cardinalblue')
    EM.stop
  }.resume
  puts "It's not blocking..."
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rest-core-1.0.2 example/eventmachine.rb
rest-core-1.0.1 example/eventmachine.rb