cosm 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +18 -3
- data/lib/cosm/command.rb +1 -1
- data/lib/cosm/command/feeds.rb +46 -0
- data/lib/cosm/command/subscribe.rb +1 -1
- data/lib/cosm/version.rb +1 -1
- metadata +22 -5
data/README.md
CHANGED
@@ -1,8 +1,23 @@
|
|
1
|
-
Cosm CLI
|
2
|
-
========
|
1
|
+
# Cosm CLI
|
3
2
|
|
4
|
-
A Cosm
|
3
|
+
A Cosm client tool
|
5
4
|
|
6
5
|
[](http://travis-ci.org/levent/cosm)
|
7
6
|
[](https://gemnasium.com/levent/cosm)
|
8
7
|
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
```bash
|
11
|
+
gem install cosm
|
12
|
+
```
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
### Connect to the socket server
|
17
|
+
|
18
|
+
You can connect to a feed or datastream and receive realtime json updates in your terminal
|
19
|
+
|
20
|
+
```bash
|
21
|
+
cosm subscribe -k YOUR_API_KEY -f FEED_ID -d DATASTREAM_ID
|
22
|
+
```
|
23
|
+
|
data/lib/cosm/command.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'cosm/command/base'
|
2
|
+
require 'cosm-rb'
|
3
|
+
|
4
|
+
# Create a Cosm feed
|
5
|
+
#
|
6
|
+
class Cosm::Command::Feeds < Cosm::Command::Base
|
7
|
+
|
8
|
+
# feeds:create [TITLE]
|
9
|
+
#
|
10
|
+
# create a Cosm feed
|
11
|
+
#
|
12
|
+
# -k, --key API_KEY # your api key
|
13
|
+
#
|
14
|
+
#Examples:
|
15
|
+
#
|
16
|
+
# $ cosm feeds:create "Home energy monitor" -k ABCD1234
|
17
|
+
#
|
18
|
+
def create
|
19
|
+
title = shift_argument
|
20
|
+
api_key = options[:key]
|
21
|
+
validate_arguments!
|
22
|
+
|
23
|
+
if title.nil?
|
24
|
+
$stderr.puts "Please provide a title"
|
25
|
+
exit(1)
|
26
|
+
end
|
27
|
+
|
28
|
+
if api_key.nil?
|
29
|
+
$stderr.puts Cosm::Command::Help.usage_for_command("feeds:create")
|
30
|
+
exit(1)
|
31
|
+
end
|
32
|
+
|
33
|
+
puts "Creating feed \"#{title}\"..."
|
34
|
+
|
35
|
+
feed = Cosm::Feed.new
|
36
|
+
feed.title = title
|
37
|
+
|
38
|
+
response = Cosm::Client.post('/v2/feeds.json', :headers => {'X-ApiKey' => api_key}, :body => feed.to_json)
|
39
|
+
if response.code == 201
|
40
|
+
puts "Your feed has been created at:"
|
41
|
+
puts response.headers['location']
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
alias_command "create", "feeds:create"
|
46
|
+
end
|
data/lib/cosm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cosm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
13
|
-
dependencies:
|
12
|
+
date: 2012-06-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: cosm-rb
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.0.3
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.0.3
|
14
30
|
description: Cosm CLI
|
15
31
|
email: lebreeze@gmail.com
|
16
32
|
executables:
|
@@ -20,6 +36,7 @@ extra_rdoc_files: []
|
|
20
36
|
files:
|
21
37
|
- lib/cosm/cli.rb
|
22
38
|
- lib/cosm/command/base.rb
|
39
|
+
- lib/cosm/command/feeds.rb
|
23
40
|
- lib/cosm/command/help.rb
|
24
41
|
- lib/cosm/command/subscribe.rb
|
25
42
|
- lib/cosm/command/version.rb
|
@@ -44,7 +61,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
61
|
version: '0'
|
45
62
|
segments:
|
46
63
|
- 0
|
47
|
-
hash:
|
64
|
+
hash: 4405844409766287960
|
48
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
66
|
none: false
|
50
67
|
requirements:
|
@@ -53,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
70
|
version: '0'
|
54
71
|
segments:
|
55
72
|
- 0
|
56
|
-
hash:
|
73
|
+
hash: 4405844409766287960
|
57
74
|
requirements: []
|
58
75
|
rubyforge_project:
|
59
76
|
rubygems_version: 1.8.23
|