arcus 0.1.2 → 0.1.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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDg3MWVlMWI5MTFhNGQzNDY1ZjBhMTM3YTNmYTYzYmI0MDZiNDNhOA==
5
+ data.tar.gz: !binary |-
6
+ MDk5OWNhZjE5MWFhOTY1OWRjMzg3ZDM2Y2MyYTBlNzcyOTc1MDNmYg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MWEzMDFiYzVkMDY5OGI2OWExNjNiYjg5ZTUzZjVlNjAxMTZkMmQ1NDAwZDhh
10
+ ZjA2MDcxMzAxNWQyYjgzYmQzZjM3NDJjMmIzOTZjMjdjMTg0NzA0NTI2ZDRj
11
+ ZWQ5YTRlMDNlZmFkZTgxODliMWI2ZmNmN2U5MzQyN2FkOGNkMmY=
12
+ data.tar.gz: !binary |-
13
+ NWJiN2M5YjBiY2I3MzE1ZGViNmJkNTY3MTg0YWIzZDc4YzEwMzUxNjA1YmQz
14
+ NWM0YzYyYjNlZmFlNmE0NWFiY2EwY2VkYmU4NTE4ZjUyNzg0OWM1ZDg3Y2Rl
15
+ MzhiN2ZlMzhjOTM0MGU2NWNiNDg4NWE5MzhmNWRiMmNkYWQ5MDQ=
data/README CHANGED
@@ -1 +1,53 @@
1
- This file was created by JetBrains RubyMine 4.0.1 for binding GitHub repository
1
+ # Arcus
2
+
3
+ A library that provides a clean API into Cloudstack REST calls. Also included is a CLI tool for making Cloudstack REST calls
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'arcus'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install arcus
18
+
19
+ ## Usage
20
+
21
+ Cloudstack REST commands are read in from the commands.xml file. This provides a list of required and optional arguments
22
+ for each Cloudstack command. Each Cloudstack command is split up into an action and a target, for instance listVirtualMachines
23
+ becomes: [action -> list, target -> VirtualMachine]. The arcus will create a dynamic class based on the name of the target and
24
+ a method named after the action. So you can do the following:
25
+
26
+ vms = VirtualMachine.new.list.fetch
27
+
28
+ vms will be a object containing the results of "listvirtualmachinesresponse"
29
+
30
+ Other "response_types" are allowed, for example:
31
+
32
+ vms = VirtualMachine.new.list.fetch(:yaml)
33
+ vms = VirtualMachine.new.list.fetch(:xml)
34
+ vms = VirtualMachine.new.list.fetch(:prettyxml)
35
+ vms = VirtualMachine.new.list.fetch(:json)
36
+ vms = VirtualMachine.new.list.fetch(:prettyjson)
37
+
38
+ Each of these calls will return a string representation in the format specified.
39
+
40
+ You can also give arguments to the "action" method. For example:
41
+
42
+ vms = VirtualMachine.new.list({id: 1}).fetch(:json)
43
+
44
+ will produce the http call -> /client/api?id=1&response=xml&command=listVirtualMachines
45
+
46
+
47
+ ## Contributing
48
+
49
+ 1. Fork it
50
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
51
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
52
+ 4. Push to the branch (`git push origin my-new-feature`)
53
+ 5. Create new Pull Request
@@ -16,8 +16,8 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Arcus::VERSION
17
17
 
18
18
  gem.add_dependency "i18n"
19
- gem.add_dependency "active_support"
20
- gem.add_dependency "nori"
19
+ gem.add_dependency "activesupport"
20
+ gem.add_dependency "nori", "~> 1.1.4"
21
21
  gem.add_dependency "nokogiri"
22
22
  gem.add_dependency "cmdparse"
23
23
  gem.add_dependency "rspec"
@@ -54,9 +54,9 @@ module Arcus
54
54
  def initialize(command_name, params, callbacks)
55
55
  @command_name = command_name
56
56
  @params = params
57
- @api_uri = Arcus::Api.settings.api_uri
58
- @api_key = Arcus::Api.settings.api_key
59
- @api_secret = Arcus::Api.settings.api_secret
57
+ @api_uri = Api.settings.api_uri
58
+ @api_key = Api.settings.api_key
59
+ @api_secret = Api.settings.api_secret
60
60
  @callbacks = callbacks
61
61
  end
62
62
 
@@ -104,7 +104,7 @@ module Arcus
104
104
  end
105
105
  params = @params.merge({:command => @command_name})
106
106
  req_url = @api_uri.path + "?" + generate_params_str(params, @api_key, @api_secret)
107
- Arcus.log.debug { "Sending: #{req_url}" } if Arcus::Api.settings.verbose
107
+ Arcus.log.debug { "Sending: #{req_url}" } if Api.settings.verbose
108
108
  response = begin
109
109
  http.get(req_url)
110
110
  rescue Timeout::Error => e
@@ -116,7 +116,7 @@ module Arcus
116
116
  e.api_uri = @api_uri
117
117
  raise e
118
118
  end
119
- Arcus.log.debug { "Received: #{response.body}" } if Arcus::Api.settings.verbose
119
+ Arcus.log.debug { "Received: #{response.body}" } if Api.settings.verbose
120
120
  response.instance_eval do
121
121
  class << self
122
122
  attr_accessor :response_type
@@ -143,7 +143,7 @@ module Arcus
143
143
  else
144
144
  callbacks[:failure].call(response) if callbacks[:failure]
145
145
  end
146
- response.body if response.is_a?(Net::HTTPSuccess)
146
+ response.body # if response.is_a?(Net::HTTPSuccess)
147
147
  end
148
148
  end
149
149
 
@@ -285,7 +285,7 @@ module Arcus
285
285
  end
286
286
 
287
287
  def prepare(params = {}, callbacks = {})
288
- params[:response] ||= Arcus::Api.settings.default_response
288
+ params[:response] ||= Api.settings.default_response
289
289
  Request.new(self.name, params, callbacks)
290
290
  end
291
291
  end
@@ -1,3 +1,3 @@
1
1
  module Arcus
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arcus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: 0.1.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - atistler
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-05 00:00:00.000000000 Z
11
+ date: 2013-10-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: i18n
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,15 +20,13 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
- name: active_support
28
+ name: activesupport
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,23 +41,20 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: nori
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ~>
52
46
  - !ruby/object:Gem::Version
53
- version: '0'
47
+ version: 1.1.4
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ~>
60
53
  - !ruby/object:Gem::Version
61
- version: '0'
54
+ version: 1.1.4
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: nokogiri
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: cmdparse
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rspec
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -135,27 +122,26 @@ files:
135
122
  - test.rb
136
123
  homepage: ''
137
124
  licenses: []
125
+ metadata: {}
138
126
  post_install_message:
139
127
  rdoc_options: []
140
128
  require_paths:
141
129
  - lib
142
130
  required_ruby_version: !ruby/object:Gem::Requirement
143
- none: false
144
131
  requirements:
145
132
  - - ! '>='
146
133
  - !ruby/object:Gem::Version
147
134
  version: '0'
148
135
  required_rubygems_version: !ruby/object:Gem::Requirement
149
- none: false
150
136
  requirements:
151
137
  - - ! '>='
152
138
  - !ruby/object:Gem::Version
153
139
  version: '0'
154
140
  requirements: []
155
141
  rubyforge_project:
156
- rubygems_version: 1.8.24
142
+ rubygems_version: 2.1.9
157
143
  signing_key:
158
- specification_version: 3
144
+ specification_version: 4
159
145
  summary: API and client CLI tool for cloudstack
160
146
  test_files:
161
147
  - spec/arcus_spec.rb