Sha256: 05208e7fabc030ededa9b2f9bd384b1afb3c439ca298244e84cd43d1d4a819ee

Contents?: true

Size: 930 Bytes

Versions: 4

Compression:

Stored size: 930 Bytes

Contents

require 'rapidash'

class Repos < Rapidash::Base
  def repo!(owner, repo)
    self.url += "/#{owner}/#{repo}"
    call!
  end
end

class Users < Rapidash::Base
  resource :repos
end

class Emojis < Rapidash::Base
end

class Events < Rapidash::Base
end

class Gists < Rapidash::Base

  def public!
    self.url += "/public"
    call!
  end

end

class Organisations < Rapidash::Base
  url "orgs"
end

class Limit < Rapidash::Base
  url "rate_limit"
end


class Client < Rapidash::Client
  method :http
  site "https://api.github.com/"
  resource :users, :repos, :emojis, :events, :gists, :organisations, :limit
end

client = Client.new

p client.limit!.rate.remaining

p client.gists.public!

client.users("Gazler").repos!.each do |repo|
  p repo.name
end

client.emojis!.each do |emoji|
  p emoji
end

client.events!.each do |event|
  p event
end

p client.organisations!("powershift")

p client.repos.repo!("Gazler", "rapidash")

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rapidash-0.1.2 examples/github.rb
rapidash-0.1.1 examples/github.rb
rapidash-0.1.0 examples/github.rb
rapidash-0.0.6 examples/github.rb