ansible_tower_client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 86a18d8f7863faba1111ec0be11334fdaee96f1e
4
+ data.tar.gz: a0fb3db7bfb6cd83a6726cab8c76836105c1a2f3
5
+ SHA512:
6
+ metadata.gz: 2f02ac1ff450afa55d3ea6f99209ed699f8037f19cec9eeb57832ef609c1905d0c97d2b8c78880b494a1e6249d5523902fe681b3ee6dfecb43a392ac8e13c68d
7
+ data.tar.gz: a32e851b0b97792c3905528584aa27696ee1b8f0f7c5469935e807694705dc069721481bbb57a687658e1743bae21e16f8b6e565c089502ef1e6d27e2388c613
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .byebug_history
11
+ .rubocop.yml
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - "2.2"
4
+ sudo: false
5
+ cache: bundler
6
+ before_install: gem install bundler -v 1.10.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ansible_tower_client.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Red Hat, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,38 @@
1
+ # AnsibleTowerClient
2
+
3
+ [![Build Status](https://travis-ci.org/ManageIQ/ansible_tower_client.svg)](https://travis-ci.org/ManageIQ/ansible_tower_client)
4
+ [![Code Climate](https://codeclimate.com/github/ManageIQ/ansible_tower_client/badges/gpa.svg)](https://codeclimate.com/github/ManageIQ/ansible_tower_client)
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'ansible_tower_client'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install ansible_tower_client
21
+
22
+ ## Usage
23
+
24
+ TODO: Write usage instructions here
25
+
26
+ ## Development
27
+
28
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+
30
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
31
+
32
+ ## Contributing
33
+
34
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ManageIQ/ansible_tower_client.
35
+
36
+ ## License
37
+
38
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ansible_tower_client/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ansible_tower_client"
8
+ spec.version = AnsibleTowerClient::VERSION
9
+ spec.authors = ["Brandon Dunne", "Drew Bomhof"]
10
+ spec.email = ["bdunne@redhat.com", "dbomhof@redhat.com"]
11
+
12
+ spec.summary = %q{Ansible Tower REST API wrapper gem}
13
+ spec.description = %q{Ansible Tower REST API wrapper gem}
14
+ spec.homepage = "https://github.com/ManageIQ/ansible_tower_client"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_runtime_dependency "faraday"
23
+ spec.add_runtime_dependency "faraday_middleware"
24
+ spec.add_runtime_dependency "more_core_extensions"
25
+ spec.add_runtime_dependency 'activesupport', '>= 1.2.0'
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.10"
28
+ spec.add_development_dependency "byebug"
29
+ spec.add_development_dependency "factory_girl"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rspec"
32
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ansible_tower_client"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,32 @@
1
+ require "ansible_tower_client/error"
2
+ require "json"
3
+ require "ansible_tower_client/logging"
4
+ require "ansible_tower_client/null_logger"
5
+ require "ansible_tower_client/valid_json"
6
+ require "ansible_tower_client/version"
7
+
8
+ require "ansible_tower_client/connection"
9
+ require "ansible_tower_client/api"
10
+ require "ansible_tower_client/hash_model"
11
+ require "ansible_tower_client/base_model"
12
+ require "ansible_tower_client/collection"
13
+
14
+ require "ansible_tower_client/ad_hoc_command"
15
+ require "ansible_tower_client/group"
16
+ require "ansible_tower_client/host"
17
+ require "ansible_tower_client/inventory"
18
+ require "ansible_tower_client/job"
19
+ require "ansible_tower_client/job_template"
20
+ require "ansible_tower_client/json_values"
21
+ require "more_core_extensions/all"
22
+ require "active_support/inflector"
23
+
24
+ module AnsibleTowerClient
25
+ class << self
26
+ attr_accessor :logger
27
+ end
28
+
29
+ def self.logger
30
+ @logger ||= NullLogger.new
31
+ end
32
+ end
@@ -0,0 +1,12 @@
1
+ module AnsibleTowerClient
2
+ class AdHocCommand < BaseModel
3
+ def relaunch
4
+ api.post("#{url}relaunch/")
5
+ end
6
+
7
+ def self.endpoint
8
+ "ad_hoc_commands".freeze
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,40 @@
1
+ module AnsibleTowerClient
2
+ class Api < Connection
3
+ attr_reader :instance
4
+ def initialize(connection)
5
+ @instance = connection
6
+ end
7
+
8
+ def hosts
9
+ Collection.new(self, Host)
10
+ end
11
+
12
+ def groups
13
+ Collection.new(self, Group)
14
+ end
15
+
16
+ def inventories
17
+ Collection.new(self, Inventory)
18
+ end
19
+
20
+ def job_templates
21
+ Collection.new(self, JobTemplate)
22
+ end
23
+
24
+ def ad_hoc_commands
25
+ Collection.new(self, AdHocCommand)
26
+ end
27
+
28
+ def jobs
29
+ Collection.new(self, Job)
30
+ end
31
+
32
+ def method_missing(method_name, *args, &block)
33
+ instance.respond_to?(method_name) ? instance.send(method_name, *args, &block) : super
34
+ end
35
+
36
+ def respond_to_missing?(method, _include_private = false)
37
+ instance.respond_to?(method)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,72 @@
1
+ module AnsibleTowerClient
2
+ class BaseModel < HashModel
3
+ attr_reader :api
4
+
5
+ # Constructs and returns a new JSON wrapper class. Pass in a plain
6
+ # JSON string and it will automatically give you accessor methods
7
+ # that make it behave like a typical Ruby object. You may also pass
8
+ # in a hash.
9
+ #
10
+ # Example:
11
+ # class Person < AnsibleTowerClient::BaseModel; end
12
+ #
13
+ # json_string = '{"firstname":"jeff", "lastname":"durand",
14
+ # "address": { "street":"22 charlotte rd", "zipcode":"01013"}
15
+ # }'
16
+ #
17
+ # # Or whatever your subclass happens to be.
18
+ # person = Person.new(api, json_string)
19
+ #
20
+ # # The JSON properties are now available as methods.
21
+ # person.firstname # => 'jeff'
22
+ # person.address.zipcode # => '01013'
23
+ #
24
+ # # Or you can get back the original JSON if necessary.
25
+ # person.to_json # => Returns original JSON
26
+ #
27
+ def initialize(api, json_or_hash)
28
+ @api = api
29
+
30
+ raw_hash = json_or_hash.kind_of?(Hash) ? json_or_hash : JSON.parse(json_or_hash)
31
+ self.class.send(:id_attr, *raw_hash['related'].keys) if raw_hash.key?('related')
32
+
33
+ super(raw_hash)
34
+ end
35
+
36
+ private
37
+
38
+ # convert a hash to an instance of nested model class
39
+ def hash_to_model(klass_name, hash)
40
+ model_klass =
41
+ if self.class.const_defined?(klass_name, false)
42
+ self.class.const_get(klass_name)
43
+ else
44
+ self.class.const_set(klass_name, Class.new(BaseModel))
45
+ end
46
+ model_klass.new(api, hash)
47
+ end
48
+
49
+ class << self
50
+ private
51
+
52
+ def id_attrs
53
+ @id_attrs || Set.new
54
+ end
55
+
56
+ # Selected attributes should be treated as ids, so '_id' will be appended
57
+ def id_attr(*attrs)
58
+ @id_attrs = id_attrs | Set.new(attrs.collect(&:to_s))
59
+ end
60
+
61
+ def key_to_attribute(key)
62
+ key = key.to_s
63
+ key = "#{key}_id" if !key.end_with?('_id') && id_attrs.include?(key)
64
+ key.underscore
65
+ end
66
+
67
+ def generate_writer?
68
+ false
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,44 @@
1
+ module AnsibleTowerClient
2
+ class Collection
3
+ attr_reader :api, :klass
4
+ def initialize(api, klass)
5
+ @api = api
6
+ @klass = klass
7
+ end
8
+
9
+ def all
10
+ collection_for(api.get(klass.endpoint))
11
+ end
12
+
13
+ def collection_for(paginated_result)
14
+ body = JSON.parse(paginated_result.body)
15
+ results = body["results"]
16
+ loop do
17
+ break if body["next"].nil?
18
+ body = JSON.parse(api.get(body["next"]).body)
19
+ results += body["results"]
20
+ end
21
+
22
+ build_collection(results)
23
+ end
24
+
25
+ def find(id)
26
+ raw_body = JSON.parse(api.get("#{klass.endpoint}/#{id}/").body)
27
+ raise ResourceNotFound.new(self, :id => id) if raw_body['id'].nil?
28
+ klass.new(api, raw_body)
29
+ end
30
+
31
+ private
32
+
33
+ def build_collection(results)
34
+ results.collect do |result|
35
+ class_from_type(result["type"]).new(api, result)
36
+ end
37
+ end
38
+
39
+ def class_from_type(type)
40
+ camelized = type.split("_").collect(&:capitalize).join
41
+ AnsibleTowerClient.const_get(camelized)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,37 @@
1
+ module AnsibleTowerClient
2
+ class Connection
3
+ attr_reader :connection
4
+
5
+ def initialize(options = nil)
6
+ raise "Credentials are required" unless options[:username] && options[:password]
7
+ raise ":base_url is required" unless options[:base_url]
8
+ verify_ssl = options[:verify_ssl] || OpenSSL::SSL::VERIFY_PEER
9
+ verify_ssl = verify_ssl == OpenSSL::SSL::VERIFY_NONE ? false : true
10
+
11
+ require 'faraday'
12
+ require 'faraday_middleware'
13
+ @connection = Faraday.new(options[:base_url], :ssl => {:verify => verify_ssl}) do |f|
14
+ f.use FaradayMiddleware::FollowRedirects, :limit => 3, :standards_compliant => true
15
+ f.request(:url_encoded)
16
+ f.adapter(Faraday.default_adapter)
17
+ f.basic_auth(options[:username], options[:password])
18
+ end
19
+ end
20
+
21
+ def api
22
+ @api ||= Api.new(connection)
23
+ end
24
+
25
+ def config
26
+ JSON.parse(api.get("config").body)
27
+ end
28
+
29
+ def version
30
+ config["version"]
31
+ end
32
+
33
+ def verify_credentials
34
+ JSON.parse(api.get("me").body).fetch_path("results", 0, "username")
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,39 @@
1
+ require 'faraday'
2
+
3
+ module AnsibleTowerClient
4
+ class ResourceNotFound < Faraday::ResourceNotFound
5
+ def initialize(klass, attrs = {})
6
+ @klass = klass
7
+ @attrs = attrs
8
+ @key = attrs.keys.first
9
+ @value = attrs[@key]
10
+ super(issue_error)
11
+ end
12
+
13
+ def issue_error
14
+ method = @key.nil? ? 'general' : @key
15
+ send("#{method}_msg")
16
+ end
17
+
18
+ private
19
+
20
+ def id_msg
21
+ "Couldn't find #{@klass} with '#{@key}'=#{@value}"
22
+ end
23
+
24
+ def general_msg
25
+ "Couldn't find #{@klass}"
26
+ end
27
+ end
28
+
29
+ class Error < StandardError
30
+ attr_reader :message
31
+ def initialize(klass)
32
+ @message = "Error on #{klass.class.name}: #{klass.inspect}"
33
+ super(message)
34
+ end
35
+ end
36
+
37
+ class InvalidHash < Error; end
38
+ class InvalidJson < Error; end
39
+ end
@@ -0,0 +1,11 @@
1
+ module AnsibleTowerClient
2
+ class Group < BaseModel
3
+ def self.endpoint
4
+ "groups".freeze
5
+ end
6
+
7
+ def children
8
+ self.class.collection_for(api.get(File.join(self.class.endpoint, id.to_s, "children")))
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,142 @@
1
+ module AnsibleTowerClient
2
+ # A core base class for JSON wrapper classes. The original data can be a JSON
3
+ # string or a hash parsed from JSON string. Similar to OpenStruct, it auto
4
+ # generates access methods base on key names. If the value is also a hash,
5
+ # it too gets converted to an instance of model class.
6
+ #
7
+ # This is an abstract class.
8
+ class HashModel
9
+ class << self
10
+ private
11
+
12
+ # Convert a key to a model class attribute which must be a qualified ruby method name
13
+ # key is from the original JSON or Hash object
14
+ #
15
+ # This is the default implementation, to be overridden by subclasses.
16
+ #
17
+ def key_to_attribute(key)
18
+ key.to_s.underscore
19
+ end
20
+
21
+ # Should setter methods be automatically created?
22
+ #
23
+ # Default to true, to be overridden by subclasses.
24
+ #
25
+ def generate_writer?
26
+ true
27
+ end
28
+
29
+ # Should values of this attribute be excluded from converting to model objects
30
+ #
31
+ # Default to false, to be overridden by subclasses.
32
+ #
33
+ def attr_excluded?(_attr_name)
34
+ false
35
+ end
36
+
37
+ # Declare attributes that need to be converted to Model
38
+ def attr_model(*attrs)
39
+ # Merge the declared attributes to the modelized list
40
+ @modelized_list = modelized_list | Set.new(attrs.map(&:to_s))
41
+ end
42
+
43
+ # Return the list of modelized attributes
44
+ def modelized_list
45
+ @modelized_list ||= Set.new
46
+ end
47
+
48
+ def convert_value(key, value, parent)
49
+ method = key_to_attribute(key)
50
+ new_val =
51
+ if attr_excluded?(method)
52
+ value
53
+ else
54
+ # Must deal with nested models
55
+ case value
56
+ when Array
57
+ value.collect do |elem|
58
+ elem.kind_of?(Hash) ? parent.send(:hash_to_model, method.camelize.singularize, elem) : elem
59
+ end
60
+ when Hash
61
+ parent.send(:hash_to_model, method.camelize, value)
62
+ else
63
+ value
64
+ end
65
+ end
66
+
67
+ add_accessor_methods(method, key)
68
+ new_val
69
+ end
70
+
71
+ def add_accessor_methods(method, key)
72
+ return if modelized_list.include?(method.to_s)
73
+
74
+ method = "_#{method}" if instance_methods.include?(method.to_sym)
75
+ class_eval { define_method(method) { @data[key] } }
76
+ attr_model(method)
77
+
78
+ return unless generate_writer?
79
+ class_eval { define_method("#{method}=") { |val| @data[key] = val } }
80
+ end
81
+ end
82
+
83
+ def initialize(json_or_hash)
84
+ raw_hash = json_or_hash.kind_of?(Hash) ? json_or_hash : JSON.parse(json_or_hash)
85
+ @data = Hash[raw_hash.collect { |key, value| [key, self.class.send(:convert_value, key, value, self)] }]
86
+ end
87
+
88
+ def [](key)
89
+ @data[key]
90
+ end
91
+
92
+ def to_h
93
+ Hash[@data.collect { |key, value| [key, value_to_hash(value)] }]
94
+ end
95
+
96
+ alias_method :to_hash, :to_h
97
+
98
+ def to_json
99
+ to_h.to_json
100
+ end
101
+
102
+ alias_method :to_s, :to_json
103
+
104
+ def inspect
105
+ string = "<#{self.class} "
106
+ string << @data.collect { |key, value| "#{self.class.send(:key_to_attribute, key)}=#{value.inspect}" }.join(", ")
107
+ string << ">"
108
+ end
109
+
110
+ def ==(other)
111
+ return false unless other.kind_of?(HashModel)
112
+ to_h == other.to_h
113
+ end
114
+
115
+ alias_method :eql?, :==
116
+
117
+ private
118
+
119
+ def value_to_hash(value)
120
+ case value
121
+ when HashModel, Hash then value.to_h
122
+ when Array then value.collect { |elem| elem.kind_of?(HashModel) ? elem.to_h : elem }
123
+ else value
124
+ end
125
+ end
126
+
127
+ # Convert a hash to an instance of nested model class
128
+ #
129
+ # This is the default implementation; the resulting object is based on HashModel
130
+ # To be overridden by subclasses
131
+ #
132
+ def hash_to_model(klass_name, hash)
133
+ model_klass =
134
+ if self.class.const_defined?("#{self.class}::#{klass_name}")
135
+ self.class.const_get(klass_name)
136
+ else
137
+ self.class.const_set(klass_name, Class.new(HashModel))
138
+ end
139
+ model_klass.new(hash)
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,11 @@
1
+ module AnsibleTowerClient
2
+ class Host < BaseModel
3
+ def self.endpoint
4
+ "hosts".freeze
5
+ end
6
+
7
+ def groups
8
+ self.class.collection_for(api.get(File.join(self.class.endpoint, id.to_s, "groups")))
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module AnsibleTowerClient
2
+ class Inventory < BaseModel
3
+ def self.endpoint
4
+ "inventories".freeze
5
+ end
6
+
7
+ def root_groups
8
+ self.class.collection_for(api.get(File.join(self.class.endpoint, id.to_s, "root_groups")))
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module AnsibleTowerClient
2
+ class Job < BaseModel
3
+ def self.endpoint
4
+ "jobs".freeze
5
+ end
6
+ end
7
+ end
8
+
@@ -0,0 +1,46 @@
1
+ module AnsibleTowerClient
2
+ class JobTemplate < BaseModel
3
+ def launch(options = {})
4
+ launch_url = "#{url}launch/"
5
+ options = options.dup
6
+ new_limit = options.delete('limit')
7
+ response = with_temporary_changes(new_limit) do
8
+ api.post(launch_url, options).body
9
+ end
10
+
11
+ job = JSON.parse(response)
12
+ api.jobs.find(job['job'])
13
+ end
14
+
15
+ def survey_spec
16
+ spec_url = related['survey_spec']
17
+ return nil unless spec_url
18
+ api.get(spec_url).body
19
+ end
20
+
21
+ def self.endpoint
22
+ "job_templates".freeze
23
+ end
24
+
25
+ private
26
+
27
+ def with_temporary_changes(in_limit)
28
+ old_limit = limit
29
+ new_limit = in_limit
30
+ patch("{ \"limit\": \"#{new_limit}\" }")
31
+ begin
32
+ yield
33
+ ensure
34
+ patch("{ \"limit\": \"#{old_limit}\" }")
35
+ end
36
+ end
37
+
38
+ def patch(body)
39
+ api.patch do |req|
40
+ req.url(url)
41
+ req.headers['Content-Type'] = 'application/json'
42
+ req.body = body
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,15 @@
1
+ module AnsibleTowerClient
2
+ class JSONValues
3
+ include ValidJSON
4
+
5
+ def initialize(vars)
6
+ raise InvalidHash.new(vars) unless vars.kind_of?(Hash)
7
+ @vars = vars
8
+ end
9
+
10
+ def extra_vars
11
+ validate(@vars['extra_vars'])
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,6 @@
1
+ module AnsibleTowerClient
2
+ module Logging
3
+ extend Forwardable
4
+ delegate :logger => :AnsibleTowerClient
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ require 'logger'
2
+
3
+ module AnsibleTowerClient
4
+ class NullLogger < Logger
5
+ def initialize(*_args)
6
+ end
7
+
8
+ def add(*_args, &_block)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module AnsibleTowerClient
2
+ module ValidJSON
3
+ def validate(text)
4
+ begin
5
+ JSON.parse(text)
6
+ rescue JSON::ParserError => e
7
+ raise InvalidJson.new(e)
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,3 @@
1
+ module AnsibleTowerClient
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,200 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ansible_tower_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brandon Dunne
8
+ - Drew Bomhof
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2016-03-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: faraday_middleware
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: more_core_extensions
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: activesupport
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.2.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 1.2.0
70
+ - !ruby/object:Gem::Dependency
71
+ name: bundler
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.10'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.10'
84
+ - !ruby/object:Gem::Dependency
85
+ name: byebug
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: factory_girl
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rake
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '10.0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '10.0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rspec
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ description: Ansible Tower REST API wrapper gem
141
+ email:
142
+ - bdunne@redhat.com
143
+ - dbomhof@redhat.com
144
+ executables: []
145
+ extensions: []
146
+ extra_rdoc_files: []
147
+ files:
148
+ - ".gitignore"
149
+ - ".rspec"
150
+ - ".travis.yml"
151
+ - Gemfile
152
+ - LICENSE.txt
153
+ - README.md
154
+ - Rakefile
155
+ - ansible_tower_client.gemspec
156
+ - bin/console
157
+ - bin/setup
158
+ - lib/ansible_tower_client.rb
159
+ - lib/ansible_tower_client/ad_hoc_command.rb
160
+ - lib/ansible_tower_client/api.rb
161
+ - lib/ansible_tower_client/base_model.rb
162
+ - lib/ansible_tower_client/collection.rb
163
+ - lib/ansible_tower_client/connection.rb
164
+ - lib/ansible_tower_client/error.rb
165
+ - lib/ansible_tower_client/group.rb
166
+ - lib/ansible_tower_client/hash_model.rb
167
+ - lib/ansible_tower_client/host.rb
168
+ - lib/ansible_tower_client/inventory.rb
169
+ - lib/ansible_tower_client/job.rb
170
+ - lib/ansible_tower_client/job_template.rb
171
+ - lib/ansible_tower_client/json_values.rb
172
+ - lib/ansible_tower_client/logging.rb
173
+ - lib/ansible_tower_client/null_logger.rb
174
+ - lib/ansible_tower_client/valid_json.rb
175
+ - lib/ansible_tower_client/version.rb
176
+ homepage: https://github.com/ManageIQ/ansible_tower_client
177
+ licenses:
178
+ - MIT
179
+ metadata: {}
180
+ post_install_message:
181
+ rdoc_options: []
182
+ require_paths:
183
+ - lib
184
+ required_ruby_version: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ required_rubygems_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ requirements: []
195
+ rubyforge_project:
196
+ rubygems_version: 2.4.5.1
197
+ signing_key:
198
+ specification_version: 4
199
+ summary: Ansible Tower REST API wrapper gem
200
+ test_files: []