Module: Gista

Defined in:
lib/gista.rb,
lib/gista/options.rb,
lib/gista/version.rb,
lib/gista/user_token.rb,
lib/gista/api_request.rb,
lib/gista/gist_request.rb,
lib/gista/login_prompt.rb,
lib/gista/token_request.rb

Overview

Gista allows for easily creating Gists from the command line or a Ruby program. For full instructions on how to use it from the command line, run gista --help.

Examples:

From the command line, listing filenames

$ gista my_file.rb another_file.rb
https://gist.github.com/...

From the command line, reading STDIN

$ rspec | gista
https://gist.github.com/...
$ gista < my_file.rb
https://gist.github.com/...

From a Ruby program

require 'gista'
Gista.post_and_get_url(oauth_token, options)

Defined Under Namespace

Classes: ApiRequest, GistRequest, LoginPrompt, Options, RequestError, TokenRequest, Unauthorized, UserToken

Constant Summary collapse

VERSION =
'1.0.0'

Class Method Summary collapse

Class Method Details

.post_and_get_url(token, options) ⇒ Object

Make a request to the Github API using the given authorization token and options. Returns the URL to the Gist if it was successful.

Parameters:

  • token (String)
  • options (Hash)


50
51
52
# File 'lib/gista.rb', line 50

def post_and_get_url(token, options)
  GistRequest.new(token, options).fetch('html_url')
end