Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

levent/cosm_app-rb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published