automate_soup 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +6 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +128 -0
  9. data/Rakefile +10 -0
  10. data/automate_soup.gemspec +31 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/docs/AutomateSoup.html +2566 -0
  14. data/docs/AutomateSoup/API.html +1174 -0
  15. data/docs/AutomateSoup/Change.html +892 -0
  16. data/docs/AutomateSoup/Credentials.html +452 -0
  17. data/docs/AutomateSoup/Rest.html +321 -0
  18. data/docs/AutomateSoup/Stage.html +428 -0
  19. data/docs/AutomateSoup/Topic.html +530 -0
  20. data/docs/_index.html +166 -0
  21. data/docs/class_list.html +51 -0
  22. data/docs/coverage/.last_run.json +5 -0
  23. data/docs/coverage/.resultset.json +145 -0
  24. data/docs/coverage/.resultset.json.lock +0 -0
  25. data/docs/coverage/assets/0.10.2/application.css +799 -0
  26. data/docs/coverage/assets/0.10.2/application.js +1707 -0
  27. data/docs/coverage/assets/0.10.2/colorbox/border.png +0 -0
  28. data/docs/coverage/assets/0.10.2/colorbox/controls.png +0 -0
  29. data/docs/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
  30. data/docs/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
  31. data/docs/coverage/assets/0.10.2/favicon_green.png +0 -0
  32. data/docs/coverage/assets/0.10.2/favicon_red.png +0 -0
  33. data/docs/coverage/assets/0.10.2/favicon_yellow.png +0 -0
  34. data/docs/coverage/assets/0.10.2/loading.gif +0 -0
  35. data/docs/coverage/assets/0.10.2/magnify.png +0 -0
  36. data/docs/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  37. data/docs/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  38. data/docs/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  39. data/docs/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  40. data/docs/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  41. data/docs/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  42. data/docs/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  43. data/docs/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  44. data/docs/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
  45. data/docs/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  46. data/docs/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
  47. data/docs/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
  48. data/docs/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  49. data/docs/coverage/index.html +968 -0
  50. data/docs/css/common.css +1 -0
  51. data/docs/css/full_list.css +58 -0
  52. data/docs/css/style.css +492 -0
  53. data/docs/file.README.html +211 -0
  54. data/docs/file_list.html +56 -0
  55. data/docs/frames.html +17 -0
  56. data/docs/index.html +211 -0
  57. data/docs/js/app.js +248 -0
  58. data/docs/js/full_list.js +216 -0
  59. data/docs/js/jquery.js +4 -0
  60. data/docs/method_list.html +395 -0
  61. data/docs/top-level-namespace.html +110 -0
  62. data/lib/automate_soup.rb +264 -0
  63. data/lib/automate_soup/api.rb +112 -0
  64. data/lib/automate_soup/change.rb +105 -0
  65. data/lib/automate_soup/credentials.rb +16 -0
  66. data/lib/automate_soup/rest.rb +40 -0
  67. data/lib/automate_soup/stage.rb +25 -0
  68. data/lib/automate_soup/version.rb +3 -0
  69. metadata +195 -0
@@ -0,0 +1,16 @@
1
+ module AutomateSoup
2
+ ##
3
+ # Credentials to authenticate with chef automate
4
+ class Credentials
5
+ attr_reader :username, :password, :token
6
+ def initialize(
7
+ username: nil,
8
+ password: nil,
9
+ token: nil
10
+ )
11
+ @username = username
12
+ @password = password
13
+ @token = token
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,40 @@
1
+ require 'net/http'
2
+ require 'json'
3
+ require 'openssl'
4
+ require 'uri'
5
+
6
+ module AutomateSoup
7
+ ##
8
+ # Rest class for making HTTP requests
9
+ module Rest
10
+ class << self
11
+ def get(url: nil, username: nil, token: nil)
12
+ uri = URI.parse(url)
13
+ http = Net::HTTP.new(uri.host, uri.port)
14
+ http.use_ssl = true
15
+ http.verify_mode = ::OpenSSL::SSL::VERIFY_NONE
16
+ request = Net::HTTP::Get.new(uri.request_uri)
17
+ request = auth_request request, username, token
18
+ res = http.request(request)
19
+ JSON.parse(res.body)
20
+ end
21
+
22
+ def post(url: nil, username: nil, token: nil)
23
+ uri = URI.parse(url)
24
+ http = Net::HTTP.new(uri.host, uri.port)
25
+ http.use_ssl = true
26
+ http.verify_mode = ::OpenSSL::SSL::VERIFY_NONE
27
+ request = Net::HTTP::Post.new(uri.request_uri)
28
+ request = auth_request request, username, token
29
+ request.add_field('Content-Type', 'application/json;charset=utf-8')
30
+ http.request(request)
31
+ end
32
+
33
+ def auth_request(request, user, token)
34
+ request.add_field('chef-delivery-user', user)
35
+ request.add_field('chef-delivery-token', token)
36
+ request
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,25 @@
1
+ require 'ostruct'
2
+ require 'byebug'
3
+
4
+ module AutomateSoup
5
+ ##
6
+ # Class to represent operations on a stage.
7
+ #
8
+ class Stage
9
+ def initialize(hash)
10
+ @source = OpenStruct.new hash
11
+ end
12
+
13
+ def method_missing(method, *args, &block)
14
+ @source.send(method, *args, &block)
15
+ end
16
+
17
+ def passed?
18
+ @source.status.eql? 'passed'
19
+ end
20
+
21
+ def failed?
22
+ @source.status.eql? 'failed'
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module AutomateSoup
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,195 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: automate_soup
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Skyler Layne
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-12-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Ruby API for interacting with Chef Automate
98
+ email:
99
+ - skylerclayne@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - CODE_OF_CONDUCT.md
108
+ - Gemfile
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - automate_soup.gemspec
113
+ - bin/console
114
+ - bin/setup
115
+ - docs/AutomateSoup.html
116
+ - docs/AutomateSoup/API.html
117
+ - docs/AutomateSoup/Change.html
118
+ - docs/AutomateSoup/Credentials.html
119
+ - docs/AutomateSoup/Rest.html
120
+ - docs/AutomateSoup/Stage.html
121
+ - docs/AutomateSoup/Topic.html
122
+ - docs/_index.html
123
+ - docs/class_list.html
124
+ - docs/coverage/.last_run.json
125
+ - docs/coverage/.resultset.json
126
+ - docs/coverage/.resultset.json.lock
127
+ - docs/coverage/assets/0.10.2/application.css
128
+ - docs/coverage/assets/0.10.2/application.js
129
+ - docs/coverage/assets/0.10.2/colorbox/border.png
130
+ - docs/coverage/assets/0.10.2/colorbox/controls.png
131
+ - docs/coverage/assets/0.10.2/colorbox/loading.gif
132
+ - docs/coverage/assets/0.10.2/colorbox/loading_background.png
133
+ - docs/coverage/assets/0.10.2/favicon_green.png
134
+ - docs/coverage/assets/0.10.2/favicon_red.png
135
+ - docs/coverage/assets/0.10.2/favicon_yellow.png
136
+ - docs/coverage/assets/0.10.2/loading.gif
137
+ - docs/coverage/assets/0.10.2/magnify.png
138
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
139
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
140
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
141
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
142
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png
143
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
144
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
145
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
146
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png
147
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png
148
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png
149
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png
150
+ - docs/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png
151
+ - docs/coverage/index.html
152
+ - docs/css/common.css
153
+ - docs/css/full_list.css
154
+ - docs/css/style.css
155
+ - docs/file.README.html
156
+ - docs/file_list.html
157
+ - docs/frames.html
158
+ - docs/index.html
159
+ - docs/js/app.js
160
+ - docs/js/full_list.js
161
+ - docs/js/jquery.js
162
+ - docs/method_list.html
163
+ - docs/top-level-namespace.html
164
+ - lib/automate_soup.rb
165
+ - lib/automate_soup/api.rb
166
+ - lib/automate_soup/change.rb
167
+ - lib/automate_soup/credentials.rb
168
+ - lib/automate_soup/rest.rb
169
+ - lib/automate_soup/stage.rb
170
+ - lib/automate_soup/version.rb
171
+ homepage: https://github.com/skylerto/automate_soup
172
+ licenses:
173
+ - MIT
174
+ metadata: {}
175
+ post_install_message:
176
+ rdoc_options: []
177
+ require_paths:
178
+ - lib
179
+ required_ruby_version: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ required_rubygems_version: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ requirements: []
190
+ rubyforge_project:
191
+ rubygems_version: 2.6.11
192
+ signing_key:
193
+ specification_version: 4
194
+ summary: Ruby API for interacting with Chef Automate
195
+ test_files: []