A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://rubydoc.info/github/piotrmurach/github/master/Github/Client/Gists below:

Gists – Documentation for piotrmurach/github (master) – RubyDoc.info

Class: Github::Client::Gists
Inherits:
API show all
Defined in:
lib/github_api/client/gists.rb
Defined Under Namespace

Classes: Comments

Constant Summary Constants included from MimeType

MimeType::MEDIA_LOOKUP

Constants included from Github::Constants

Github::Constants::ACCEPT, Github::Constants::ACCEPTED_OAUTH_SCOPES, Github::Constants::ACCEPT_CHARSET, Github::Constants::CACHE_CONTROL, Github::Constants::CONTENT_LENGTH, Github::Constants::CONTENT_TYPE, Github::Constants::DATE, Github::Constants::ETAG, Github::Constants::HEADER_LAST, Github::Constants::HEADER_LINK, Github::Constants::HEADER_NEXT, Github::Constants::LOCATION, Github::Constants::META_FIRST, Github::Constants::META_LAST, Github::Constants::META_NEXT, Github::Constants::META_PREV, Github::Constants::META_REL, Github::Constants::OAUTH_SCOPES, Github::Constants::PARAM_PAGE, Github::Constants::PARAM_PER_PAGE, Github::Constants::PARAM_START_PAGE, Github::Constants::RATELIMIT_LIMIT, Github::Constants::RATELIMIT_REMAINING, Github::Constants::RATELIMIT_RESET, Github::Constants::SERVER, Github::Constants::USER_AGENT

Instance Attribute Summary Attributes inherited from API

#current_options

Instance Method Summary collapse Methods inherited from API

after_callbacks, after_request, #api_methods_in, #arguments, before_callbacks, before_request, clear_request_methods!, #disable_redirects, #execute, extend_with_actions, extra_methods, #extract_basic_auth, extract_class_name, #filter_callbacks, inherited, #initialize, internal_methods, method_added, #method_missing, #module_methods_in, namespace, request_methods, require_all, #respond_to?, root!, #run_callbacks, #set, #yield_or_eval

Methods included from Request::Verbs

#delete_request, #get_request, #head_request, #options_request, #patch_request, #post_request, #put_request

Methods included from RateLimit

#ratelimit, #ratelimit_remaining, #ratelimit_reset

Methods included from MimeType

#lookup_media, #parse

Methods included from Authorization

#auth_code, #authenticated?, #authentication, #authorize_url, #basic_authed?, #client, #get_token

Constructor Details

This class inherits a constructor from Github::API

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Github::API

Instance Method Details #commits(*args) ⇒ Object
189
190
191
192
193
194
195
# File 'lib/github_api/client/gists.rb', line 189

def commits(*args)
  arguments(args, required: [:id])

  response = get_request("/gists/#{arguments.id}/commits")
  return response unless block_given?
  response.each { |el| yield el }
end
#create(*args) ⇒ Hash
131
132
133
134
135
# File 'lib/github_api/client/gists.rb', line 131

def create(*args)
  arguments(args)

  post_request("/gists", arguments.params)
end
#delete(*args) ⇒ Object
283
284
285
286
287
# File 'lib/github_api/client/gists.rb', line 283

def delete(*args)
  arguments(args, required: [:id])

  delete_request("/gists/#{arguments.id}", arguments.params)
end
#edit(*args) ⇒ Hash
174
175
176
177
178
# File 'lib/github_api/client/gists.rb', line 174

def edit(*args)
  arguments(args, required: [:id])

  patch_request("/gists/#{arguments.id}", arguments.params)
end
#fork(*args) ⇒ Object
251
252
253
254
255
# File 'lib/github_api/client/gists.rb', line 251

def fork(*args)
  arguments(args, required: [:id])

  post_request("/gists/#{arguments.id}/forks", arguments.params)
end
#forks(*args) ⇒ Object
266
267
268
269
270
271
272
# File 'lib/github_api/client/gists.rb', line 266

def forks(*args)
  arguments(args, required: [:id])

  response = get_request("/gists/#{arguments.id}/forks")
  return response unless block_given?
  response.each { |el| yield el }
end
#get(*args) ⇒ Hash Also known as: find

Get a single gist

Get a specific revision of gist

90
91
92
93
94
95
96
97
98
# File 'lib/github_api/client/gists.rb', line 90

def get(*args)
  arguments(args, required: [:id])

  if (sha = arguments.params.delete('sha'))
    get_request("/gists/#{arguments.id}/#{sha}")
  else
    get_request("/gists/#{arguments.id}", arguments.params)
  end
end
#list(*args) ⇒ Hash Also known as: all

List a user’s gists

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

List all public gists

38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/github_api/client/gists.rb', line 38

def list(*args)
  params = arguments(args).params

  response = if (user = params.delete('user'))
    get_request("/users/#{user}/gists", params)
  elsif args.map(&:to_s).include?('public')
    get_request("/gists/public", params)
  else
    get_request("/gists", params)
  end
  return response unless block_given?
  response.each { |el| yield el }
end
#star(*args) ⇒ Object
206
207
208
209
210
# File 'lib/github_api/client/gists.rb', line 206

def star(*args)
  arguments(args, required: [:id])

  put_request("/gists/#{arguments.id}/star", arguments.params)
end
#starred(*args) ⇒ Hash

List the authenticated user’s starred gists

64
65
66
67
68
69
# File 'lib/github_api/client/gists.rb', line 64

def starred(*args)
  arguments(args)
  response = get_request("/gists/starred", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end
#starred?(*args) ⇒ Boolean

Check if a gist is starred

236
237
238
239
240
241
242
# File 'lib/github_api/client/gists.rb', line 236

def starred?(*args)
  arguments(args, required: [:id])
  get_request("/gists/#{arguments.id}/star", arguments.params)
  true
rescue Github::Error::NotFound
  false
end
#unstar(*args) ⇒ Object
221
222
223
224
225
# File 'lib/github_api/client/gists.rb', line 221

def unstar(*args)
  arguments(args, required: [:id])

  delete_request("/gists/#{arguments.id}/star", arguments.params)
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4