No description, website, or topics provided.
Ruby JavaScript CoffeeScript
Switch branches/tags
Nothing to show
Latest commit 57bd07f Jan 11, 2013 @levent [rails] 3.2.11
Permalink
Failed to load latest commit information.
app
config
lib
log
public
script
.gitignore
Gemfile
Gemfile.lock
Procfile
README.md
Rakefile
config.ru

README.md

A sample Cosm Rails App

This app updates a Cosm feed using the cosm-rb library

View it running at: http://cosm-app-rb.herokuapp.com/

Get Started

  1. Signup for free on cosm.com
  2. Create an api key on Cosm

Create a Feed

The cosm-rb library makes it easy to convert Ruby objects into Cosm ones.

feed = Cosm::Feed.new # initialize a new Feed object
feed.title = "My Cosm Feed"
feed.datastreams = [Cosm::Datastream.new(:id => 'test')] # Let's give it one datastream with id 'test'

Let's see what it looks like:

feed.to_json
=> {"title":"Test feed","version":"1.0.0","datastreams":[{"id":"test"}]}

Let's create the feed on Cosm

response = Cosm::Client.post('/v2/feeds.json', :headers => {"X-ApiKey" => YOUR_API_KEY}, :body => feed.to_json)
puts response.headers['location'] # Will give us the location of the Cosm feed including the ID
=> "http://api.cosm.com/v2/feeds/SOMEID"

Further Information

Check out the API documentation

More coming