<commit_before>= ActiveGist! {<img src="https://secure.travis-ci.org/sinisterchipmunk/active-gist.png" />}[http://travis-ci.org/sinisterchipmunk/active-gist]

I needed a Ruby library to perform basic create, read, update and delete operations on Gists. I looked, I saw basically nothing (except hacky, test-less tools), and I decided to roll my own. Here's the result.

ActiveGist is so named because it wraps GitHub's Gist API with a class implementing the ActiveModel modules. So, it should be pretty familiar to anyone who's ever used models in Ruby on Rails.

== Installation

The obligatory installation steps, in case you haven't yet figured out they're the same as any other gem...

  gem install activegist

== Usage

  require 'rubygems' # on old rubies
  require 'activegist'
  
  # Set up credentials. A required step, as far as I know.
  ActiveGist::API.username = "gist owner's github username"
  ActiveGist::API.password = "<PASSWORD>"
  
  # Various examples of creating and saving a new gist
  gist = ActiveGist.new
  gist.description = "gist description"
  gist.files                                              #=> {}
  gist.files['test.txt'] = { :content => 'file content' }
  gist.save                                               #=> true or false<commit_msg>readme update<commit_after>= ActiveGist! {<img src="https://secure.travis-ci.org/sinisterchipmunk/active-gist.png" />}[http://travis-ci.org/sinisterchipmunk/active-gist]

I needed a Ruby library to perform basic create, read, update and delete operations on Gists. I looked, I saw basically nothing (except hacky, test-less tools), and I decided to roll my own. Here's the result.

ActiveGist is so named because it wraps GitHub's Gist API with a class implementing the ActiveModel modules. So, it should be pretty familiar to anyone who's ever used models in Ruby on Rails.

== Installation

The obligatory installation steps...

  gem install activegist

== Usage

  require 'rubygems' # on old rubies
  require 'activegist'
  
  # Set up credentials. A required step, as far as I know.
  ActiveGist::API.username = "gist owner's github username"
  ActiveGist::API.password = "<PASSWORD>"
  
  # Various examples of creating and saving a new gist
  gist = ActiveGist.new
  gist.description = "gist description"
  gist.files                                              #=> {}
  gist.files['test.txt'] = { :content => 'file content' }
  gist.save                                               #=> true or false
{'fraction_non_alphanumeric': 0.09105495387083835, 'fraction_numerical': 0.0, 'mean_word_length': 2.9213836477987423, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2672410', 'n_tokens_mistral': 712, 'n_tokens_neox': 689, 'n_words': 276}