axl 0.0.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b270637b5fe400525d716e3b93c39f4e1574c58
4
- data.tar.gz: 2f7d66f43fd59181b15e04f77bc4fd072e916e1d
3
+ metadata.gz: c2e8b992e611f152ae91a620f7cd0795bfc1fbb2
4
+ data.tar.gz: 39a472890dedfc24903021599d3d0efb41874f45
5
5
  SHA512:
6
- metadata.gz: 9c97c768eedc190da3897dd8b2db94ad6eafa296b86479b9fa1595924375d9db76de738c162595018562399990bb3ed89167face962adbb0600528258993fa1c
7
- data.tar.gz: 5025765cdbf8fe4548e3ef72e740a9f55dbee306d007892b526250560dcc18e21a74a95658f9f3ef813bf5d84ec9a8500e978f6669525247d1a5db6be844a146
6
+ metadata.gz: 371d1b20a855ccb76f58360b082aab95113969e1a1765482d67d724ae85516a53f1a5587e19c9381bcdb7e4c318d2a4fb7c2f5fdea8523df61f05b75b4413e5b
7
+ data.tar.gz: dc0850d819453be65a008488e0a8d585a65cf03ed2eb7edff8424fd40d584af5ad1e0c5c8f038e49d914fe3a012aed11e3830cefd243ced06c91c881c7b5b2d4
@@ -0,0 +1,9 @@
1
+ .DS_Store
2
+ *.gem
3
+ .ruby-version
4
+ !.ruby-version.example
5
+ axl.yml
6
+ coverage
7
+ Gemfile.lock
8
+ tmp/*.*
9
+ !tmp/.gitkeep
@@ -0,0 +1 @@
1
+ axl
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p598
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify production and development-only dependencies in jet.gemspec
4
+ gemspec
5
+
6
+ # We're separating these dependencies from the development dependencies
7
+ # specified in the gemspec. This is so that, should we start running Axl
8
+ # tests in the CI, we can exclude the development dependencies while
9
+ # keeping the following in. That will help with the build speed.
10
+ group :test do
11
+ gem 'json', '~> 1.8.0'
12
+ gem 'minitest', '~> 4.7.0'
13
+ gem 'minitest-reporters', '~> 0.14.20'
14
+ gem 'mocha', '~> 1.1.0'
15
+ gem 'rake'
16
+ gem 'simplecov', '~> 0.7.0'
17
+ gem 'vcr', '~> 2.8.0'
18
+ end
@@ -0,0 +1,6 @@
1
+ guard 'minitest' do
2
+ watch(%r|^lib/axl\.rb|) { "test" }
3
+ watch(%r|^lib/axl/(.*)\.rb|) { |m| "test/axl/#{m[1]}_test.rb" }
4
+ watch(%r|^test/test_helper\.rb|) { "test" }
5
+ watch(%r|^test/axl/.*_test\.rb|) # Run the matched file
6
+ end
@@ -0,0 +1,13 @@
1
+ Copyright 2015 Nexus IS
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,131 @@
1
+ AXL: Ruby Bindings for the Cisco Administrative XML (AXL) API
2
+ =============================================================
3
+
4
+ ## Installation
5
+
6
+ ### Install from rubygems.org
7
+
8
+ 1. `gem install axl`
9
+
10
+ ### ...or Install locally
11
+
12
+ 1. Clone this repo
13
+ 1. `cd` to this repo's top dir
14
+ 1. `rm *.gem`
15
+ 1. `gem build axl.gemspec`
16
+ 1. `gem install axl`
17
+
18
+ ### Download the Cisco AXL Toolkit
19
+
20
+ Due to copyright restrictions, this gem does not come with the Cisco
21
+ AXL WSDL files. Download the Cisco AXL Toolkit by following these instructions.
22
+
23
+ 1. Browse to your CUCM web interface
24
+ 1. Click on Cisco Unified Communications Manager and log in
25
+ 1. Click Application > Plugins
26
+ 1. Click the Find button
27
+ 1. You should see a "Cisco AXL Toolkit" entry in the results
28
+ 1. Click Download on that result
29
+ 1. Extract the contents to the home directory of the user that the axl gem
30
+ will run as. If you are going to run the gem directly, extract it to
31
+ your home directory as axlsqltoolkit
32
+ 1. You should end up with the following directory structure:
33
+
34
+ ```
35
+ <USER_HOMEDIR>
36
+ └── axlsqltoolkit
37
+ ├── README.txt
38
+ ├── classes/
39
+ ├── client/
40
+ ├── lib/
41
+ ├── sample.xml
42
+ ├── schema/
43
+ │   ├── 10.0/
44
+ │   ├── 10.5/
45
+ │   ├── 8.0/
46
+ │   ├── 8.5/
47
+ │   ├── 9.0/
48
+ │   ├── 9.1/
49
+ │   └── current/
50
+ └── src/
51
+ ```
52
+
53
+ The gem will assume the above directory structure exists and will use that
54
+ assumption to get to the correct WSDL files in the schema/ directory.
55
+
56
+ ## Schema Reference
57
+
58
+ You will need to consult the appropriate schema reference when developing.
59
+ To download a copy of the appropriate reference document, visit:
60
+
61
+ https://developer.cisco.com/site/axl/documents/previous-versions/index.gsp
62
+
63
+ ## Usage
64
+
65
+ ```
66
+ require 'axl'
67
+
68
+ # If you don't supply a version, it will default to '10.5'
69
+ client = Axl::Client.new(endpoint: 'https://192.168.10.11:8443/axl/',
70
+ api_version: '10.5',
71
+ username: 'myusername',
72
+ password: 'mypassword')
73
+
74
+ # Print the available operations
75
+ puts client.operations
76
+
77
+ # Call an operation
78
+ message = {
79
+ search_criteria: {
80
+ name: 'test'
81
+ }
82
+ }
83
+ response = client.call(:list_line_group, message: message)
84
+
85
+ puts response.success?
86
+ puts response.header
87
+ puts response.body
88
+ puts response.hash
89
+ ```
90
+
91
+ See the appropriate schema reference for the API version you're working with
92
+ for more information about the operation arguments.
93
+
94
+ ## Development Setup
95
+
96
+ ### Requirements
97
+
98
+ 1. RVM. Not a hard requirement but will make your life easier
99
+ 1. Ruby MRI ruby-2.0.0-p598
100
+ 1. Bundler (`gem install bundler`)
101
+
102
+ ### Set Stuff Up!
103
+
104
+ 1. If you're using RVM, copy .ruby-version.example to .ruby-version and
105
+ modify the contents to indicate the Ruby version you need to use during
106
+ development. Once done `cd` out and `cd` back in.
107
+ 1. Run `bundle install`
108
+ 1. What are you still doing here? You're done!
109
+
110
+ ### Running the Tests Manually
111
+
112
+ 1. Run `rake`
113
+
114
+ Fix bugs. Rinse. Repeat.
115
+
116
+ ### Running the Tests Automatically
117
+
118
+ 1. Run `guard`
119
+
120
+ Guard will watch for changes under the lib/ directory and execute the
121
+ associated test(s) automatically. Also, if any tests in the test/ directory
122
+ change, that test will automatically get executed. To see how Guard
123
+ determines which test to execute given a file changed, see Guardfile.
124
+
125
+ ### Code Coverage
126
+
127
+ After running the tests (either via `rake` or `guard`), the coverage report
128
+ will be saved to coverage/index.html. Note that triggerring a single test
129
+ case via guard will produce an incomplete coverage report since it will
130
+ only exercise a limited set of the code. To ensure complete code coverage
131
+ reports, press <ENTER> in the guard prompt or just run `rake` manually.
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.pattern = "test/axl/**/*_test.rb"
6
+ t.libs.push 'test'
7
+ end
8
+
9
+ task :default => :test
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ require 'axl/version'
6
+ require 'axl/utils/compatibility'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = "axl"
10
+ spec.version = Axl::VERSION
11
+ spec.authors = ["Nexus IS Dev Team"]
12
+ spec.email = ["dev@nexusis.com"]
13
+ spec.description = "Ruby Bindings for the Cisco Administrative XML (AXL) API"
14
+ spec.summary = "Ruby Bindings for the Cisco Administrative XML (AXL) API"
15
+ spec.homepage = "http://nexusis.com"
16
+ spec.license = "Apache 2.0"
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.test_files = spec.files.grep(%r{^(test)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ # Runtime dependencies
23
+ spec.add_runtime_dependency 'savon', '~> 2.0'
24
+ spec.add_runtime_dependency 'webmock', '>= 1.8.0', '< 1.16'
25
+
26
+ # Development dependencies. See Gemfile for more non-prod dependencies.
27
+ spec.add_development_dependency 'bundler', '~> 1.0'
28
+ spec.add_development_dependency 'guard', '~> 1.8', '>= 1.8.0'
29
+ spec.add_development_dependency 'guard-rake', '~> 0.0', '>= 0.0.0'
30
+ spec.add_development_dependency 'guard-minitest', '~> 0.5', '>= 0.5.0'
31
+ spec.add_development_dependency 'rb-fsevent', '~> 0.9', '>= 0.9.0'
32
+
33
+ if /darwin|mac os/ === RbConfig::CONFIG['host_os']
34
+ spec.add_development_dependency 'terminal-notifier-guard', '~> 1.5', '>= 1.5.3'
35
+ else
36
+ spec.add_development_dependency 'ruby_gntp', '~> 0.3', '>= 0.3.0'
37
+ end
38
+
39
+ spec.add_development_dependency 'pry', '~> 0.9', '>= 0.9.0'
40
+ spec.add_development_dependency 'redcarpet', '~> 2.3', '>= 2.3.0'
41
+ spec.add_development_dependency 'yard', '~> 0.8', '>= 0.8.0'
42
+ end
@@ -0,0 +1,18 @@
1
+ server1: &server1
2
+ endpoint: https://192.168.10.1:8443/axl/
3
+ api_version: 10.5
4
+ username: myusername
5
+ password: mypassword
6
+
7
+ server2: &server2
8
+ endpoint: https://192.168.10.2:8443/axl/
9
+ api_version: 11
10
+ username: myusername
11
+ password: mypassword
12
+
13
+
14
+ test:
15
+ <<: *server1
16
+
17
+ production:
18
+ <<: *server2
@@ -0,0 +1,5 @@
1
+ require 'axl/utils/compatibility'
2
+ require 'axl/utils/string'
3
+ require 'axl/version'
4
+ require 'axl/configuration'
5
+ require 'axl/client'
@@ -0,0 +1,40 @@
1
+ require 'savon'
2
+ require 'forwardable'
3
+
4
+
5
+ module Axl
6
+
7
+ class Client
8
+ extend Forwardable
9
+
10
+ def_delegators :@client, :call, :operations
11
+
12
+ def initialize(endpoint: nil, api_version: '10.5', username: nil, password: nil)
13
+ wsdl_path = wsdl_path(api_version.to_s)
14
+
15
+ if endpoint.class == String && endpoint[-1] != '/'
16
+ # Cisco AXL API doesn't like it if you don't add a trailing slash
17
+ endpoint << '/'
18
+ end
19
+
20
+ # Notice how we're disabling SSL verification. This library is meant
21
+ # to be used within a data center. If you are worried about a MITM
22
+ # attack happening while using this library, you have bigger problems
23
+ # to deal with than this library's SSL strategy.
24
+ @client = Savon.client(endpoint: endpoint,
25
+ wsdl: wsdl_path,
26
+ ssl_verify_mode: :none,
27
+ basic_auth: [username, password],
28
+ namespace: "http://www.cisco.com/AXL/API/#{api_version}")
29
+ end
30
+
31
+ private
32
+
33
+ def wsdl_path(version)
34
+ path = ['~', 'axlsqltoolkit', 'schema', version, 'AXLAPI.wsdl']
35
+ File.expand_path(File.join(*path))
36
+ end
37
+
38
+ end
39
+
40
+ end
@@ -0,0 +1,76 @@
1
+ require 'forwardable'
2
+
3
+ module Axl
4
+
5
+ # ==========
6
+ # EXCEPTIONS
7
+ # ==========
8
+
9
+ class ConfigurationFileNotFoundError < StandardError
10
+
11
+ def initialize(path)
12
+ msg = "The configuration file could not be found at #{path}."
13
+ super msg
14
+ end
15
+
16
+ end
17
+
18
+ # ===================
19
+ # CONFIGURATION CLASS
20
+ # ===================
21
+
22
+ class Configuration
23
+
24
+ # =============
25
+ # CLASS METHODS
26
+ # =============
27
+
28
+ class << self
29
+
30
+ def load(path, env: 'production')
31
+ Configuration.new(path, env: env)
32
+ end
33
+
34
+ end
35
+
36
+ # ===========
37
+ # INITIALIZER
38
+ # ===========
39
+
40
+ def initialize(path, env: nil)
41
+ begin
42
+ @config = YAML.load_file(path)[env.to_s]
43
+ rescue Errno::ENOENT
44
+ raise ConfigurationFileNotFoundError.new(path) unless Pathname.new(path).exist?
45
+ end
46
+ end
47
+
48
+ # ======
49
+ # PUBLIC
50
+ # ======
51
+
52
+ def to_h
53
+ config.dup
54
+ end
55
+
56
+ # =======
57
+ # PRIVATE
58
+ # =======
59
+
60
+ private
61
+
62
+ def config
63
+ @config
64
+ end
65
+
66
+ def method_missing(name, *args, &block) # :nodoc:
67
+ if config.has_key? name.to_s
68
+ config[name.to_s]
69
+ else
70
+ super name, *args, &block
71
+ end
72
+ end
73
+
74
+ end
75
+
76
+ end
@@ -0,0 +1,41 @@
1
+ module Axl
2
+
3
+ module Utils
4
+
5
+ module Compatibility
6
+ RUBY_1_8_MODE = (not (RUBY_VERSION =~ /1\.8\.\d*/).nil?)
7
+ end
8
+
9
+ end
10
+
11
+ end
12
+
13
+ if Axl::Utils::Compatibility::RUBY_1_8_MODE
14
+
15
+ class Module
16
+
17
+ # Redefine certain Module instance methods so that they're
18
+ # consistent across the various Ruby versions that we support.
19
+
20
+ alias_method :old_const_defined?, :const_defined?
21
+
22
+ def const_defined?(sym, ignore=nil)
23
+ old_const_defined?(sym)
24
+ end
25
+
26
+
27
+ alias_method :old_const_get, :const_get
28
+
29
+ def const_get(sym, ignore=nil)
30
+ old_const_get(sym)
31
+ end
32
+
33
+ alias_method :old_instance_methods, :instance_methods
34
+
35
+ def instance_methods(include_super=true)
36
+ old_instance_methods(include_super).map(&:to_sym)
37
+ end
38
+
39
+ end
40
+
41
+ end
@@ -0,0 +1,30 @@
1
+ module Axl
2
+
3
+ module Utils
4
+
5
+ class String
6
+
7
+ class <<self
8
+
9
+ def camelize(str)
10
+ word = str.slice(0,1).capitalize + str.slice(1..-1)
11
+ word.gsub(/_([a-zA-Z\d])/) { "#{$1.capitalize}" }
12
+ end
13
+
14
+ def constantize(str)
15
+ str.split("::").inject(Object) do |namespace, sym|
16
+ namespace.const_get(self.camelize(sym.to_s), false)
17
+ end
18
+ end
19
+
20
+ def underscore(str)
21
+ str.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,4 @@
1
+ module Axl
2
+ # NOTE: Axl follows semver (http://semver.org/)
3
+ VERSION = "0.1.1"
4
+ end
@@ -0,0 +1,43 @@
1
+ require 'test_helper'
2
+
3
+
4
+ class Axl::ClientTest < Axl::VCRBackedTest
5
+
6
+ describe 'Axl::Client' do
7
+
8
+ let(:client) do
9
+ # NOTE: 'config' is defined in base test class under test/support
10
+ Axl::Client.new(endpoint: config.endpoint,
11
+ api_version: config.api_version,
12
+ username: config.username,
13
+ password: config.password)
14
+ end
15
+
16
+ describe '#call' do
17
+
18
+ it 'calls a given operation' do
19
+ message = {
20
+ search_criteria: {
21
+ name: 'test'
22
+ }
23
+ }
24
+ response = client.call(:list_line_group, message: message)
25
+ response.success?.must_equal true
26
+ end
27
+
28
+ end
29
+
30
+
31
+ describe '#operations' do
32
+
33
+ it 'returns an array of symbols' do
34
+ operations = client.operations
35
+
36
+ operations.must_be_instance_of Array
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+
43
+ end
@@ -0,0 +1,59 @@
1
+ require 'pathname'
2
+ require 'test_helper'
3
+
4
+
5
+ class Axl::ConfigurationTest < Axl::Test
6
+
7
+ describe 'Axl::Configuration' do
8
+
9
+ let :path do
10
+ Pathname.new(__FILE__).join('..', '..', 'support', 'bogus.yml')
11
+ end
12
+
13
+ let :valid_config do
14
+ {
15
+ 'test' => {
16
+ 'endpoint' => 'somewhere'
17
+ }
18
+ }
19
+ end
20
+
21
+ describe '::load' do
22
+
23
+ it 'loads the configuration from the given path for the given env' do
24
+ YAML.expects(:load_file).with(path).returns(valid_config)
25
+
26
+ config = Axl::Configuration.load(path, env: 'test')
27
+
28
+ config.must_be_instance_of Axl::Configuration
29
+ config.to_h.must_equal valid_config['test']
30
+ end
31
+
32
+ it 'throws an error when the configuration file is not found' do
33
+ method = lambda do
34
+ Axl::Configuration.load(path, env: 'test')
35
+ end
36
+ method.must_raise Axl::ConfigurationFileNotFoundError
37
+
38
+ error = method.call rescue $!
39
+
40
+ error.message.wont_be_nil
41
+ end
42
+
43
+ end
44
+
45
+ describe '#endpoint' do
46
+
47
+ it 'returns the configured endpoint for the env' do
48
+ YAML.stubs(:load_file).returns(valid_config)
49
+
50
+ config = Axl::Configuration.load(path, env: 'test')
51
+
52
+ config.endpoint.must_equal valid_config['test']['endpoint']
53
+ end
54
+
55
+ end
56
+
57
+ end
58
+
59
+ end
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://appuser:Nexus1sLab@10.21.111.233:8443/axl/
6
+ body:
7
+ encoding: UTF-8
8
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd1="http://www.cisco.com/AXL/API/10.5"
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><xsd1:listLineGroup><searchCriteria><name>test</name></searchCriteria></xsd1:listLineGroup></env:Body></env:Envelope>
11
+ headers:
12
+ Soapaction:
13
+ - '"CUCM:DB ver=10.5 listLineGroup"'
14
+ Content-Type:
15
+ - text/xml;charset=UTF-8
16
+ Content-Length:
17
+ - '379'
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ Accept:
21
+ - '*/*'
22
+ User-Agent:
23
+ - Ruby
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Set-Cookie:
30
+ - JSESSIONID=D3F89E494F8F3331F8D7DA17F1CD83E5; Path=/axl/; Secure; HttpOnly
31
+ - JSESSIONIDSSO=072051ACE8519CBB9CA3B699AAB9D0D8; Path=/; Secure; HttpOnly
32
+ X-Frame-Options:
33
+ - SAMEORIGIN
34
+ Content-Type:
35
+ - text/xml;charset=UTF-8
36
+ Transfer-Encoding:
37
+ - chunked
38
+ Date:
39
+ - Mon, 05 Oct 2015 22:53:33 GMT
40
+ Server:
41
+ - ''
42
+ body:
43
+ encoding: UTF-8
44
+ string: |-
45
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/10.5"><soapenv:Body><ns:listLineGroupResponse><return/></ns:listLineGroupResponse></soapenv:Body></soapenv:Envelope>
46
+ <!--This API has been processed by GAXL not AXL-->
47
+ http_version:
48
+ recorded_at: Mon, 05 Oct 2015 22:53:38 GMT
49
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,43 @@
1
+ module Axl
2
+
3
+ class Test < MiniTest::Spec
4
+
5
+ let(:config) do
6
+ Axl::Configuration.load(
7
+ Pathname.new(__FILE__).join('..', '..', '..', 'axl.yml'),
8
+ env: 'test')
9
+ end
10
+
11
+ end
12
+
13
+
14
+ class VCRBackedTest < Test
15
+
16
+ def cassette_name
17
+ path = self.class.to_s \
18
+ .gsub(/^axl\//, '') \
19
+ .gsub(/^Axl::Test::/, '') \
20
+ .gsub(/::#/, '/i_') \
21
+ .gsub(/::::/, '/c_') \
22
+ .gsub(/::/, '/')
23
+
24
+ path = Axl::Utils::String.underscore(path)
25
+
26
+ basename = __name__.gsub(/test_\d+_/, '')
27
+
28
+ "#{ path }/#{ basename }"
29
+ end
30
+
31
+
32
+ before do
33
+ ::VCR.insert_cassette cassette_name
34
+ end
35
+
36
+
37
+ after do
38
+ ::VCR.eject_cassette
39
+ end
40
+
41
+ end
42
+
43
+ end
@@ -0,0 +1,106 @@
1
+ require 'vcr'
2
+
3
+
4
+ VCR.configure do |c|
5
+ c.cassette_library_dir = Pathname.new(__FILE__).join('..', '..', 'cassettes')
6
+ c.debug_logger = File.open(Pathname.new(__FILE__).join('..', '..', '..', 'tmp', 'vcr.log'), 'w')
7
+ c.hook_into :webmock
8
+
9
+ # unless @vcr_port_matcher_registered
10
+ # # References:
11
+ # # From VCR :docs => http://goo.gl/j0fiJ
12
+ # # Discussion by :author => http://goo.gl/p9q4r
13
+ # c.register_request_matcher :port do |r1, r2|
14
+ # r1.parsed_uri.port == r2.parsed_uri.port
15
+ # end
16
+ # @vcr_port_matcher_registered = true
17
+ # end
18
+ #
19
+ # unless @vcr_json_body_matcher_registered
20
+ # # References:
21
+ # # From VCR :docs => http://goo.gl/j0fiJ
22
+ # # Discussion by :author => http://goo.gl/p9q4r
23
+ # c.register_request_matcher :json_body do |r1, r2|
24
+ # if r1.body.length != r2.body.length
25
+ # false
26
+ # elsif r1.body.empty?
27
+ # true
28
+ # else
29
+ # JSON.parse(r1.body) == JSON.parse(r2.body)
30
+ # end
31
+ # end
32
+ # @vcr_json_body_matcher_registered = true
33
+ # end
34
+ #
35
+ # unless @vcr_custom_headers_matcher_registered
36
+ # # References:
37
+ # # From VCR :docs => http://goo.gl/j0fiJ
38
+ # # Discussion by :author => http://goo.gl/p9q4r
39
+ # c.register_request_matcher :custom_headers do |r1, r2|
40
+ # r1.headers["User-Agent"] = r2.headers["User-Agent"]
41
+ # r1.headers == r2.headers
42
+ # end
43
+ # @vcr_custom_headers_matcher_registered = true
44
+ # end
45
+ #
46
+ # #=========== BEGIN FILTERS FOR SENSITIVE DATA ===========
47
+ #
48
+ # configs = [:openstack_admin, :openstack_member]
49
+ # env = Aviator::Test::Environment
50
+ #
51
+ # [:username, :password, :tenantName, :tokenId].each do |key|
52
+ # configs.each do |config|
53
+ # c.filter_sensitive_data("<#{ config.to_s.upcase }_#{key.to_s.upcase}>") do
54
+ # env.send(config)[:auth_credentials][key] || env.send(config)[:auth_credentials][Aviator::StrUtil.underscore(key.to_s)]
55
+ # end
56
+ # end
57
+ # end
58
+ #
59
+ # configs.each do |config|
60
+ #
61
+ # c.filter_sensitive_data("<#{ config.to_s.upcase }_HOST_URI>") do
62
+ # auth_url = URI(env.send(config)[:auth_service][:host_uri])
63
+ # auth_url.scheme + '://' + auth_url.host
64
+ # end
65
+ #
66
+ # # In a multi-host environment, this will come in handy since HOST_URI wont match the
67
+ # # URI of services or resources available in a different host but same domain.
68
+ # c.filter_sensitive_data("<#{ config.to_s.upcase }_ENV_DOMAIN>") do
69
+ # domain_patterns = Regexp.union([
70
+ # /\.[\w-]+\.[^\.]+\.\w{2,3}$/,
71
+ # /\.[^\.]+\.\w{2,3}$/,
72
+ # /\.[^\.]+\.\w{2,3}.\w+$/,
73
+ # /^\w+$/
74
+ # ])
75
+ #
76
+ # auth_url = URI(env.send(config)[:auth_service][:host_uri])
77
+ # auth_url.host.match(domain_patterns)
78
+ # end
79
+ #
80
+ # end
81
+
82
+ #=========== END FILTERS FOR SENSITIVE DATA ===========
83
+
84
+ c.default_cassette_options = {
85
+ # IF NOT RUNNING IN CI:
86
+ # If no cassette exists for a spec, VCR will record. Afterwards, VCR will
87
+ # stop recording for that spec. If new requests are made that are not
88
+ # matched by anything in the cassette, an error is thrown
89
+ #
90
+ # IF RUNNING IN CI:
91
+ # Test should immediately throw an error if no cassette exists for a
92
+ # given example that needs one.
93
+ # :record => (ENV['CI'] || ENV['TRAVIS'] ? :none : :once),
94
+ :record => :new_episodes,
95
+
96
+ :match_requests_on => [:method],
97
+
98
+ # Strict mocking
99
+ # Inspired :by => http://myronmars.to/n/dev-blog/2012/06/thoughts-on-mocking
100
+ :allow_unused_http_interactions => false,
101
+
102
+ # Enable ERB in the cassettes.
103
+ # :Reference => http://goo.gl/aPXYk
104
+ :erb => true
105
+ }
106
+ end
@@ -0,0 +1,25 @@
1
+ $:.unshift File.expand_path(File.join('..', '..', 'lib'), __FILE__)
2
+
3
+ require 'simplecov'
4
+ SimpleCov.command_name 'MiniTest'
5
+ SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
6
+
7
+ SimpleCov.start do
8
+ add_filter '/test/'
9
+ add_filter '/.bundled_gems/'
10
+ end
11
+
12
+ require 'minitest/autorun'
13
+ require 'mocha/setup'
14
+
15
+ # In case running in the CI
16
+ unless ['BUILD_NUMBER', 'CI', 'JENKINS_URL'].any? { |name| ENV.key? name }
17
+ require 'pry'
18
+ end
19
+
20
+ # Load all helpers in test/support
21
+ Dir[Pathname.new(__FILE__).join('..', 'support', '*.rb')].each do |f|
22
+ require f
23
+ end
24
+
25
+ require 'axl'
File without changes
metadata CHANGED
@@ -1,201 +1,221 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: axl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nexus IS Dev Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-28 00:00:00.000000000 Z
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: webmock
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.8.0
34
+ - - <
35
+ - !ruby/object:Gem::Version
36
+ version: '1.16'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 1.8.0
44
+ - - <
45
+ - !ruby/object:Gem::Version
46
+ version: '1.16'
27
47
  - !ruby/object:Gem::Dependency
28
48
  name: bundler
29
49
  requirement: !ruby/object:Gem::Requirement
30
50
  requirements:
31
- - - "~>"
51
+ - - ~>
32
52
  - !ruby/object:Gem::Version
33
53
  version: '1.0'
34
54
  type: :development
35
55
  prerelease: false
36
56
  version_requirements: !ruby/object:Gem::Requirement
37
57
  requirements:
38
- - - "~>"
58
+ - - ~>
39
59
  - !ruby/object:Gem::Version
40
60
  version: '1.0'
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: guard
43
63
  requirement: !ruby/object:Gem::Requirement
44
64
  requirements:
45
- - - "~>"
65
+ - - ~>
46
66
  - !ruby/object:Gem::Version
47
67
  version: '1.8'
48
- - - ">="
68
+ - - '>='
49
69
  - !ruby/object:Gem::Version
50
70
  version: 1.8.0
51
71
  type: :development
52
72
  prerelease: false
53
73
  version_requirements: !ruby/object:Gem::Requirement
54
74
  requirements:
55
- - - "~>"
75
+ - - ~>
56
76
  - !ruby/object:Gem::Version
57
77
  version: '1.8'
58
- - - ">="
78
+ - - '>='
59
79
  - !ruby/object:Gem::Version
60
80
  version: 1.8.0
61
81
  - !ruby/object:Gem::Dependency
62
82
  name: guard-rake
63
83
  requirement: !ruby/object:Gem::Requirement
64
84
  requirements:
65
- - - "~>"
85
+ - - ~>
66
86
  - !ruby/object:Gem::Version
67
87
  version: '0.0'
68
- - - ">="
88
+ - - '>='
69
89
  - !ruby/object:Gem::Version
70
90
  version: 0.0.0
71
91
  type: :development
72
92
  prerelease: false
73
93
  version_requirements: !ruby/object:Gem::Requirement
74
94
  requirements:
75
- - - "~>"
95
+ - - ~>
76
96
  - !ruby/object:Gem::Version
77
97
  version: '0.0'
78
- - - ">="
98
+ - - '>='
79
99
  - !ruby/object:Gem::Version
80
100
  version: 0.0.0
81
101
  - !ruby/object:Gem::Dependency
82
102
  name: guard-minitest
83
103
  requirement: !ruby/object:Gem::Requirement
84
104
  requirements:
85
- - - "~>"
105
+ - - ~>
86
106
  - !ruby/object:Gem::Version
87
107
  version: '0.5'
88
- - - ">="
108
+ - - '>='
89
109
  - !ruby/object:Gem::Version
90
110
  version: 0.5.0
91
111
  type: :development
92
112
  prerelease: false
93
113
  version_requirements: !ruby/object:Gem::Requirement
94
114
  requirements:
95
- - - "~>"
115
+ - - ~>
96
116
  - !ruby/object:Gem::Version
97
117
  version: '0.5'
98
- - - ">="
118
+ - - '>='
99
119
  - !ruby/object:Gem::Version
100
120
  version: 0.5.0
101
121
  - !ruby/object:Gem::Dependency
102
122
  name: rb-fsevent
103
123
  requirement: !ruby/object:Gem::Requirement
104
124
  requirements:
105
- - - "~>"
125
+ - - ~>
106
126
  - !ruby/object:Gem::Version
107
127
  version: '0.9'
108
- - - ">="
128
+ - - '>='
109
129
  - !ruby/object:Gem::Version
110
130
  version: 0.9.0
111
131
  type: :development
112
132
  prerelease: false
113
133
  version_requirements: !ruby/object:Gem::Requirement
114
134
  requirements:
115
- - - "~>"
135
+ - - ~>
116
136
  - !ruby/object:Gem::Version
117
137
  version: '0.9'
118
- - - ">="
138
+ - - '>='
119
139
  - !ruby/object:Gem::Version
120
140
  version: 0.9.0
121
141
  - !ruby/object:Gem::Dependency
122
142
  name: terminal-notifier-guard
123
143
  requirement: !ruby/object:Gem::Requirement
124
144
  requirements:
125
- - - "~>"
145
+ - - ~>
126
146
  - !ruby/object:Gem::Version
127
147
  version: '1.5'
128
- - - ">="
148
+ - - '>='
129
149
  - !ruby/object:Gem::Version
130
150
  version: 1.5.3
131
151
  type: :development
132
152
  prerelease: false
133
153
  version_requirements: !ruby/object:Gem::Requirement
134
154
  requirements:
135
- - - "~>"
155
+ - - ~>
136
156
  - !ruby/object:Gem::Version
137
157
  version: '1.5'
138
- - - ">="
158
+ - - '>='
139
159
  - !ruby/object:Gem::Version
140
160
  version: 1.5.3
141
161
  - !ruby/object:Gem::Dependency
142
162
  name: pry
143
163
  requirement: !ruby/object:Gem::Requirement
144
164
  requirements:
145
- - - "~>"
165
+ - - ~>
146
166
  - !ruby/object:Gem::Version
147
167
  version: '0.9'
148
- - - ">="
168
+ - - '>='
149
169
  - !ruby/object:Gem::Version
150
170
  version: 0.9.0
151
171
  type: :development
152
172
  prerelease: false
153
173
  version_requirements: !ruby/object:Gem::Requirement
154
174
  requirements:
155
- - - "~>"
175
+ - - ~>
156
176
  - !ruby/object:Gem::Version
157
177
  version: '0.9'
158
- - - ">="
178
+ - - '>='
159
179
  - !ruby/object:Gem::Version
160
180
  version: 0.9.0
161
181
  - !ruby/object:Gem::Dependency
162
182
  name: redcarpet
163
183
  requirement: !ruby/object:Gem::Requirement
164
184
  requirements:
165
- - - "~>"
185
+ - - ~>
166
186
  - !ruby/object:Gem::Version
167
187
  version: '2.3'
168
- - - ">="
188
+ - - '>='
169
189
  - !ruby/object:Gem::Version
170
190
  version: 2.3.0
171
191
  type: :development
172
192
  prerelease: false
173
193
  version_requirements: !ruby/object:Gem::Requirement
174
194
  requirements:
175
- - - "~>"
195
+ - - ~>
176
196
  - !ruby/object:Gem::Version
177
197
  version: '2.3'
178
- - - ">="
198
+ - - '>='
179
199
  - !ruby/object:Gem::Version
180
200
  version: 2.3.0
181
201
  - !ruby/object:Gem::Dependency
182
202
  name: yard
183
203
  requirement: !ruby/object:Gem::Requirement
184
204
  requirements:
185
- - - "~>"
205
+ - - ~>
186
206
  - !ruby/object:Gem::Version
187
207
  version: '0.8'
188
- - - ">="
208
+ - - '>='
189
209
  - !ruby/object:Gem::Version
190
210
  version: 0.8.0
191
211
  type: :development
192
212
  prerelease: false
193
213
  version_requirements: !ruby/object:Gem::Requirement
194
214
  requirements:
195
- - - "~>"
215
+ - - ~>
196
216
  - !ruby/object:Gem::Version
197
217
  version: '0.8'
198
- - - ">="
218
+ - - '>='
199
219
  - !ruby/object:Gem::Version
200
220
  version: 0.8.0
201
221
  description: Ruby Bindings for the Cisco Administrative XML (AXL) API
@@ -204,7 +224,30 @@ email:
204
224
  executables: []
205
225
  extensions: []
206
226
  extra_rdoc_files: []
207
- files: []
227
+ files:
228
+ - .gitignore
229
+ - .ruby-gemset
230
+ - .ruby-version.example
231
+ - Gemfile
232
+ - Guardfile
233
+ - LICENSE.txt
234
+ - README.md
235
+ - Rakefile
236
+ - axl.gemspec
237
+ - axl.yml.example
238
+ - lib/axl.rb
239
+ - lib/axl/client.rb
240
+ - lib/axl/configuration.rb
241
+ - lib/axl/utils/compatibility.rb
242
+ - lib/axl/utils/string.rb
243
+ - lib/axl/version.rb
244
+ - test/axl/client_test.rb
245
+ - test/axl/configuration_test.rb
246
+ - test/cassettes/axl/client/i_call/calls_a_given_operation.yml
247
+ - test/support/base_test_class.rb
248
+ - test/support/vcr_setup.rb
249
+ - test/test_helper.rb
250
+ - tmp/.gitkeep
208
251
  homepage: http://nexusis.com
209
252
  licenses:
210
253
  - Apache 2.0
@@ -215,19 +258,25 @@ require_paths:
215
258
  - lib
216
259
  required_ruby_version: !ruby/object:Gem::Requirement
217
260
  requirements:
218
- - - ">="
261
+ - - '>='
219
262
  - !ruby/object:Gem::Version
220
263
  version: '0'
221
264
  required_rubygems_version: !ruby/object:Gem::Requirement
222
265
  requirements:
223
- - - ">="
266
+ - - '>='
224
267
  - !ruby/object:Gem::Version
225
268
  version: '0'
226
269
  requirements: []
227
270
  rubyforge_project:
228
- rubygems_version: 2.2.2
271
+ rubygems_version: 2.4.6
229
272
  signing_key:
230
273
  specification_version: 4
231
274
  summary: Ruby Bindings for the Cisco Administrative XML (AXL) API
232
- test_files: []
275
+ test_files:
276
+ - test/axl/client_test.rb
277
+ - test/axl/configuration_test.rb
278
+ - test/cassettes/axl/client/i_call/calls_a_given_operation.yml
279
+ - test/support/base_test_class.rb
280
+ - test/support/vcr_setup.rb
281
+ - test/test_helper.rb
233
282
  has_rdoc: