orizuru 0.1.2 → 0.1.3

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: 8eafdc849e34fbfef5e6d2529f1561f3f383c6cd
4
- data.tar.gz: a8bc4eb1f85ed29c6ce63eb13d9a22eec2ddf3a2
3
+ metadata.gz: 952e4ef524ca5d49b35317f5ac290750ddff9bb3
4
+ data.tar.gz: cf0e5d0e223d29eb0db6b84334d41ee0aea5e3b2
5
5
  SHA512:
6
- metadata.gz: 5625c74f8720dbbf1501252c5bd4db46f84bee1ca6beeb8db03c39a9db678dbd4aada464077b5c2ecd00f9f2f75231f0fdfdd6ebdc6de1506f0cd2fbb1b1e433
7
- data.tar.gz: 194de28fdc9d8b2305d82832f62f295897dccba7b0838d4086d813d6a4fc5a5c7ef2bab29d26c9864581519c0d2f3e532f9b3ac9cab4770d2c3362f3de57c254
6
+ metadata.gz: 963c7f2f1b3bc45fd4d49b1a671bb27bc49110555afabb3d50cb836d853d3a825afa8803b9a84515ec8550216fc8b53a2c64dde6050814f864a183e0add03640
7
+ data.tar.gz: 2ca9f763d44d80d6ad632f8202fbe0a6a4049c73cc6c8237b540441b11c0a56debd8ab391dbf100bbdae63ce353ebc84e922cd80ecb42ea29c4cba3738cb51b2
data/README.md CHANGED
@@ -20,7 +20,25 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ ### Get application info
24
+
25
+ ```ruby
26
+ require 'Orizuru'
27
+ client = Orizuru.create('http://YOUR_TSURU_HOST', 'YOUR_TSURU_TOKEN')
28
+
29
+ app = client.app('application_name')
30
+ ```
31
+
32
+ ### Get applications
33
+
34
+ ```ruby
35
+ require 'Orizuru'
36
+ client = Orizuru.create('http://YOUR_TSURU_HOST', 'YOUR_TSURU_TOKEN')
37
+
38
+ client.apps.each do |app|
39
+ p app.name
40
+ end
41
+ ```
24
42
 
25
43
  ## Development
26
44
 
@@ -10,26 +10,30 @@ module Orizuru
10
10
  # @return [Array<Orizuru::App>]
11
11
  def apps
12
12
  response = @connection.get '/apps'
13
+
13
14
  result = []
15
+
14
16
  response.body.each do |app|
15
- units = []
16
- app = (@connection.get '/apps/' + app['name']).body
17
+ result.push app(app['name'])
18
+ end
17
19
 
18
- app['units'].each do |unit|
19
- units.push Unit.new(unit['ID'], unit['Name'], unit['Status'])
20
- end
20
+ return result
21
+ end
21
22
 
22
- p app['repository']
23
- app = App.new(app['name'],
24
- app['ip'],
25
- app['cname'],
26
- app['repository'],
27
- units)
23
+ # @return [Orizuru::App]
24
+ def app(app_name)
25
+ app = (@connection.get '/apps/%s' % app_name).body
28
26
 
29
- result.push app
27
+ units = []
28
+ app['units'].each do |unit|
29
+ units.push Unit.new(unit['ID'], unit['Name'], unit['Status'])
30
30
  end
31
31
 
32
- return result
32
+ App.new(app['name'],
33
+ app['ip'],
34
+ app['cname'],
35
+ app['repository'],
36
+ units)
33
37
  end
34
38
  end
35
39
  end
@@ -1,3 +1,3 @@
1
1
  module Orizuru
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orizuru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mori Reo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-08 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday