Module: Githubris::API::Gist

Included in:
Githubris::API
Defined in:
lib/githubris/api/gist.rb

Instance Method Summary collapse

Instance Method Details

#delete_gist(id) ⇒ Object



29
30
31
32
# File 'lib/githubris/api/gist.rb', line 29

def delete_gist(id)
  set_request_path(gist_path(id))
  _delete
end

#delete_gist_star(id) ⇒ Object



24
25
26
27
# File 'lib/githubris/api/gist.rb', line 24

def delete_gist_star(id)
  set_request_path(gist_star_path(id))
  _delete
end

#get_gist(id) ⇒ Object



15
16
17
# File 'lib/githubris/api/gist.rb', line 15

def get_gist(id)
  get_gist_from(gist_path(id))
end

#get_gist_starred?(id) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
37
38
39
40
41
42
# File 'lib/githubris/api/gist.rb', line 34

def get_gist_starred?(id)
  set_request_path(gist_star_path(id))
  case _get.code
  when 204
    true
  when 404
    false
  end
end

#get_public_gists(options = {}) ⇒ Object



11
12
13
# File 'lib/githubris/api/gist.rb', line 11

def get_public_gists(options={})
  get_gists_from(public_gists_path, options)
end

#get_user_gists(login, options = {}) ⇒ Object



3
4
5
# File 'lib/githubris/api/gist.rb', line 3

def get_user_gists(, options={})
  get_gists_from(user_gists_path(), options)
end

#get_user_starred_gists(options = {}) ⇒ Object



7
8
9
# File 'lib/githubris/api/gist.rb', line 7

def get_user_starred_gists(options={})
  get_gists_from(user_starred_gists_path, options)
end

#patch_gist(id, params) ⇒ Object



48
49
50
# File 'lib/githubris/api/gist.rb', line 48

def patch_gist(id, params)
  patch_gist_to(gist_path(id), params)
end

#post_gist(params) ⇒ Object



44
45
46
# File 'lib/githubris/api/gist.rb', line 44

def post_gist(params)
  post_gist_to(gists_path, params)
end

#put_gist_star(id) ⇒ Object



19
20
21
22
# File 'lib/githubris/api/gist.rb', line 19

def put_gist_star(id)
  set_request_path(gist_star_path(id))
  _put(@target.to_s, @options.merge(:headers => {'Content-Length' => '0'}))
end