<commit_before>h1. Ruby client library for the Google Storage API

This is the first release and supports all the basic operations.  Advanced support for ACLs etc.. coming soon

h2. Install the gem

sudo gem install gstore

h2. Using the gem

Visit "The Google Storage Key Manager":https://sandbox.google.com/storage/m/manage to get your access and secret keys.

In your code just: <code>require 'gstore'</code>

h2. Example

Create an instance of the client with your credentials:

<pre><code>client = GStore::Client.new(
   :access_key => 'YOUR_ACCESS_KEY',
   :secret_key => 'YOUR_SECRET_KEY'
)

client.list_buckets
</code></pre>

Here are some example bucket operations:

<pre><code>client.create_bucket('my_unique_bucket')
client.get_bucket('my_unique_bucket')
client.delete_bucket('my_unique_bucket')
</code></pre>

Once you have a bucket you can manipulate objects in the following way:

<pre><code>client.put_object('my_unique_bucket', 'my_first_object', :data => File.read('mytext.txt'))
puts client.get_object('my_unique_bucket', 'my_first_object') # returns the contents of the object
client.get_object('my_unique_bucket', 'my_first_object', :outfile => 'retrieved_mytext.txt') # saves the contents in specified file
client.delete_object('my_unique_bucket', 'my_first_object')
</code></pre><commit_msg>updated documentation<commit_after>h1. Ruby client library for the Google Storage API

This is the first release and supports all the basic operations.  Advanced support for ACLs etc.. coming soon

h2. Install the gem

sudo gem install gstore

h2. Using the gem

Visit "The Google Storage Key Manager":https://sandbox.google.com/storage/m/manage to get your access and secret keys.

In your code just: <code>require 'gstore'</code>

h2. Example

Create an instance of the client with your credentials:

<pre><code>client = GStore::Client.new(
   :access_key => 'YOUR_ACCESS_KEY',
   :secret_key => 'YOUR_SECRET_KEY'
)

client.list_buckets
</code></pre>

Here are some example bucket operations:

<pre><code># Create a Bucket
client.create_bucket('my_unique_bucket')

# Retrieve a Bucket
client.get_bucket('my_unique_bucket')

# Delete a [empty] Bucket
client.delete_bucket('my_unique_bucket')
</code></pre>

Once you have a bucket you can manipulate objects in the following way:

<pre><code># Store a file in a bucket
client.put_object('my_unique_bucket', 'my_first_object', :data => File.read('mytext.txt'))

# Retrieve the contents of the object in the specified bucket
puts client.get_object('my_unique_bucket', 'my_first_object')

# Alternatively specify an outfile and the contents will be saved to there
client.get_object('my_unique_bucket', 'my_first_object', :outfile => 'retrieved_mytext.txt')

# Delete an object from the bucket
client.delete_object('my_unique_bucket', 'my_first_object')
</code></pre>
{'fraction_non_alphanumeric': 0.10651096956829441, 'fraction_numerical': 0.0028308563340410475, 'mean_word_length': 5.730952380952381, 'pattern_counts': {'":': 2, '<': 31, '<?xml version=': 0, '>': 39, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1622830', 'n_tokens_mistral': 893, 'n_tokens_neox': 871, 'n_words': 286}