Sha256: 5bcc4cf48ed073a4fafb182518586ccf2d3a025edd5dd4df23ffe2c4ea0df489

Contents?: true

Size: 924 Bytes

Versions: 8

Compression:

Stored size: 924 Bytes

Contents

require 'rapidash'

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

class User < Rapidash::Base
  resource :repos
end

class Emoji < Rapidash::Base
end

class Event < Rapidash::Base
end

class Gist < Rapidash::Base

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

end

class Organisation < 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

8 entries across 8 versions & 1 rubygems

Version Path
rapidash-0.4.0 examples/github.rb
rapidash-0.3.1 examples/github.rb
rapidash-0.3.0 examples/github.rb
rapidash-0.3.0.beta2 examples/github.rb
rapidash-0.3.0.beta examples/github.rb
rapidash-0.2.2 examples/github.rb
rapidash-0.2.1 examples/github.rb
rapidash-0.2.0 examples/github.rb