nidobata 0.2.0 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28923e7136f125f2cc070b8cf3f9f53ee5fa59f3
4
- data.tar.gz: d06a7763f4f873b47ee713c429037a310efad830
3
+ metadata.gz: 9406b4676173d12fe4894d19c005421fa6b76b71
4
+ data.tar.gz: 18451da692b9cbd9a6ed160540702b8e5df0a827
5
5
  SHA512:
6
- metadata.gz: 03961df86ad5a0d39993706797caf4c7f2fff1d4abe07153b7962eec3c1071b4c784a8ede542536dbb70a771d413b6af75b2cb8637c9da59ac0a0cdffb3a6b7e
7
- data.tar.gz: a5a1373448d219fb5f2e26318d0ed29323eb2582172bedc820f833dc9183cea1d9427215e41fd4bcb1eb548d52603b2db203bc550ff7919a3b7d4a9b81c7e24d
6
+ metadata.gz: 493c84f5dce90d5ebc1eeefbdbede36613b66caabc22ac9b6773465b9eab6d705aff9f3aaaf2207373e4d37a681a033823c2ced60c9183c5e631c65b56673a6a
7
+ data.tar.gz: b117612bb6fd0463d9d61c2022947b1b2b8919e9a92845681c9dc3c0d9df0737f30fe09d616dbe126fb31dd4b37b582270eb649c39d26afad449f88e4fd2a3db
data/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  ![selection_553](https://cloud.githubusercontent.com/assets/43346/21834741/10668980-d7fb-11e6-9852-b587950e3982.png)
6
6
 
7
+ Chat: [idobata/oss](https://idobata.io/#/organization/idobata/room/oss)
8
+
7
9
  ## Installation
8
10
 
9
11
  $ gem install nidobata
data/lib/nidobata.rb CHANGED
@@ -41,6 +41,29 @@ module Nidobata
41
41
  http.post('/api/messages', payload.to_json, default_headers).value
42
42
  end
43
43
 
44
+ desc 'rooms [ORG_SLUG]', 'list rooms'
45
+ def rooms(slug = nil)
46
+ ensure_api_token
47
+
48
+ if slug
49
+ rooms_url = "/api/rooms?organization_slug=#{slug}"
50
+ org_slug = -> _ { slug }
51
+ else
52
+ rooms_url = "/api/rooms"
53
+ orgs = JSON.parse(http.get("/api/organizations", default_headers).tap(&:value).body)
54
+ org_slug = -> id do
55
+ org = orgs["organizations"].detect {|org| org["id"] == id }
56
+ org["slug"]
57
+ end
58
+ end
59
+
60
+ rooms = JSON.parse(http.get(rooms_url, default_headers).tap(&:value).body)
61
+
62
+ rooms["rooms"].each do |room|
63
+ puts "#{org_slug[room["organization_id"]]}/#{room["name"]}"
64
+ end
65
+ end
66
+
44
67
  no_commands do
45
68
  private
46
69
 
@@ -1,3 +1,3 @@
1
1
  module Nidobata
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nidobata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hibariya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-11 00:00:00.000000000 Z
11
+ date: 2017-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.5.1
108
+ rubygems_version: 2.6.8
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: Read stdin and post it into idobata.io.