README.md in contextio-0.5.0 vs README.md in contextio-1.0.0

- old
+ new

@@ -1,35 +1,75 @@ -Context.IO Gem Source -===================== +# Context.IO -This repository contains the source for the Context.IO gem. +* [Homepage](https://github.com/benhamill/contextio#readme) +* [API Documentation](http://context.io/docs/2.0/) +* [Sign Up](http://context.io) -If all you want is to use the gem can install it with the following command: +## Description - gem install contextio +Provides a Ruby interface to [Context.IO](http://context.io). The general design +was inspired by the wonderful [aws-sdk](https://github.com/aws/aws-sdk-ruby) +gem. You start with an object that represents your account with Context.IO and +then you deal with collections within that going forward. Check out the example. -You can get more information at [http://context.io](http://context.io). Complete API documentation is available at [http://context.io/docs/2.0/](http://context.io/docs/2.0/). +If you're looking at the Context.IO docs, it is important to note that there are +some attributes that've been renamed to be a bit more Ruby-friendly. In general, +if the API returns a number meant to be seconds-from-epoch, then it's been +converted to return a `Time` (e.g. `updated` has changed to `updated_at`) and a +boolean has converted to something with a `?` at the end (e.g. `HasChildren` and +`initial_import_finished` are `has_children?` and `initial_import_finished?`, +respectively). -An example ----------- +## Example - require 'contextio' - require 'json' +```ruby +require 'contextio' - key = 'the key you get in your developer console' - secret = ' the secret you get in your developer console' - account = 'your account id' +contextio = ContextIO.new('your_api_key', 'your_api_secret') - connection = ContextIO::Connection.new(key, secret) - messages = connection.list_messages(:account => account, :since => (Time.now - 24 * 60 * 60 * 5)) - puts JSON.parse(messages.body).first['subject'] +account = contextio.accounts.where(email: 'some@email.com').first -LICENSE -------- +account.email_addresses # ['some@email.com', 'another@email.com'] +account.first_name # 'Bruno' +account.suspended? # False -Copyright (C) 2011 DokDok Inc. +account.messages.where(folder: '\Drafts').each do |m| + puts m.subject +end +``` -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +## Install -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + $ gem install contextio -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +Or, of course, put this in your Gemfile: + + gem contextio + +## Version Numbers + +This gem adheres to [SemVer](http://semver.org/). So you should be pretty safe +upgrading from 1.0.0 to 1.9.9. Whatever as long as the major version doesn't +bump. When the major version bumps, be warned; upgrading will take some kind of +effort. + +## Contributing + +Help is gladly welcomed. If you have a feature you'd like to add, it's much more +likely to get in (or get in faster) the closer you stick to these steps: + +1. Open an Issue to talk about it. We can discuss whether it's the right + direction or maybe help track down a bug, etc. +1. Fork the project, and make a branch to work on your feature/fix. Master is + where you'll want to start from. +1. Turn the Issue into a Pull Request. There are several ways to do this, but + [hub](https://github.com/defunkt/hub) is probably the easiest. +1. Make sure your Pull Request includes tests. + +If you don't know how to fix something, even just a Pull Request that includes a +failing test can be helpful. If in doubt, make an Issue to discuss. + +## Copyright + +Copyright (c) 2012 Context.IO + +See LICENSE.md for details.