class Github::Gists

def comments

Access to Gists::Comments API
def comments
  @comments ||= ApiFactory.new 'Gists::Comments'
end

def create(params={})


}
}
'content' => 'String file contents'
'file1.txt' => {
'files' => {
'public' => true,
'description' => 'the description for this gist',
github.gists.create
github = Github.new
= Examples

:content - Required string - File contents.
the value another required hash with parameters:
The key of which should be a required string filename and
:files - Required hash - Files that make up this gist.
:public - Required boolean
:description - Optional string
= Inputs

Create a gist
def create(params={})
  normalize! params
  assert_required_keys(REQUIRED_GIST_INPUTS, params)
  post_request("/gists", params)
end

def delete(gist_id, params={})


github.gists.delete 'gist-id'
github = Github.new
= Examples

Delete a gist
def delete(gist_id, params={})
  assert_presence_of gist_id
  normalize! params
  delete_request("/gists/#{gist_id}", params)
end

def edit(gist_id, params={})


}
'delete_the_file.txt' => nil
},
'content' => 'a new file contents'
'new_file.txt' => {
},
'content' => 'modified contents'
'filename' => 'new_name.txt',
'old_name.txt' => {
},
'content' => 'Updated file contents'
'file1.txt' => {
'files' => {
'description' => 'the description for this gist',
github.gists.edit 'gist-id',
github = Github.new :oauth_token => '...'
= Examples

:filename - Optional string - New name for this file.
:content - Updated string - Update file contents.
the value another optional hash with parameters:
The key of which should be a optional string filename and
:files - Optional hash - Files that make up this gist.
:description - Optional string
= Inputs

Edit a gist
def edit(gist_id, params={})
  assert_presence_of gist_id
  normalize! params
  patch_request("/gists/#{gist_id}", params)
end

def fork(gist_id, params={})


github.gists.fork 'gist-id'
github = Github.new
= Examples

Fork a gist
def fork(gist_id, params={})
  assert_presence_of gist_id
  normalize! params
  post_request("/gists/#{gist_id}/fork", params)
end

def get(gist_id, params={})


github.gists.get 'gist-id'
github = Github.new
= Examples

Get a single gist
def get(gist_id, params={})
  normalize! params
  assert_presence_of gist_id
  get_request("/gists/#{gist_id}", params)
end

def initialize(options = {})

Creates new Gists API
def initialize(options = {})
  super(options)
end

def list(params={})


github.gists.list
github = Github.new :oauth_token => '...'
= Examples

this will returns all public gists
List the authenticated user’s gists or if called anonymously,

github.gists.list user: 'user-name'
github = Github.new
= Examples

List a user's gists.
def list(params={})
  normalize! params
  user = params.delete('user')
  response = if user
    get_request("/users/#{user}/gists", params)
  elsif oauth_token
    get_request("/gists", params)
  else
    get_request("/gists/public", params)
  end
  return response unless block_given?
  response.each { |el| yield el }
end

def star(gist_id, params={})


github.gists.star 'gist-id'
github = Github.new
= Examples

Star a gist
def star(gist_id, params={})
  assert_presence_of gist_id
  normalize! params
  put_request("/gists/#{gist_id}/star", params)
end

def starred(params={})


github.gists.starred
github = Github.new :oauth_token => '...'
= Examples

List the authenticated user's starred gists
def starred(params={})
  normalize! params
  response = get_request("/gists/starred", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def starred?(gist_id, params={})


github.gists.starred? 'gist-id'
github = Github.new
= Examples

Check if a gist is starred
def starred?(gist_id, params={})
  assert_presence_of gist_id
  normalize! params
  get_request("/gists/#{gist_id}/star", params)
  true
rescue Github::Error::NotFound
  false
end

def unstar(gist_id, params={})


github.gists.unstar 'gist-id'
github = Github.new
= Examples

Unstar a gist
def unstar(gist_id, params={})
  assert_presence_of gist_id
  normalize! params
  delete_request("/gists/#{gist_id}/star", params)
end