mms-api 0.0.7 → 0.0.8

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: dcfd755e463ac666d8e74d34a431c3717b077740
4
- data.tar.gz: 729f27cc6f767df07686fbaae459636e489c2561
3
+ metadata.gz: 8a105e082d9ced5d68e42aee67686335005933ee
4
+ data.tar.gz: 075b3be253bb229508ea4782091d8fe5d0fdbd6a
5
5
  SHA512:
6
- metadata.gz: cfe42349fbce3d933b355a92c173bbdde3cc6852fdcdac9141658eba1b05419f22e150dd9538b2ef4150ac06ecf55658f7f691ef512db1046cbca2d5752aae9e
7
- data.tar.gz: 010ec281cb1a8251c3950b92d724208e0bcb1ad208a34ce6635102b8e17917a49c382460d1e618fc661d7a3787316d7e372e082790fbde7c05fcc2c3a0d397fd
6
+ metadata.gz: cb36e55f69d541c3bcc3a9924059c833a8c0f56f3d2ffc21105756b868a112a6689619f1edfa141f35d4ee00e838b32a06feb8bfb8658bd1187bb2f6597462c7
7
+ data.tar.gz: 05dfa0e848bbd32438114b4fef7c86c28fb16487b39ed68c8b895038dafd34117c9147bcae29f34393d2f80a75be03c0c03d44a120535d6cdbc47062ae5bb28b
data/README.md CHANGED
@@ -26,6 +26,7 @@ Options:
26
26
 
27
27
  -u, --username <string> MMS user
28
28
  -k, --apikey <string> MMS api-key
29
+ -a, --apiurl <string> MMS api url. Full url including version: https://mms.mydomain.tld/api/public/v1.0
29
30
  -n, --name <string> Filter by resource name using regexp
30
31
  -l, --limit <int> Limit for result items
31
32
  -v, --version Version
@@ -27,6 +27,10 @@ optparse = OptionParser.new do |opts|
27
27
  options[:apikey] = k
28
28
  end
29
29
 
30
+ opts.on("-a", "--apiurl <string>", "MMS api url. Full url including version: https://mms.mydomain.tld/api/public/v1.0") do |a|
31
+ options[:apiurl] = a
32
+ end
33
+
30
34
  options[:name] = '.*'
31
35
  opts.on("-n", "--name <string>", "Filter for resource name using regexp") do |n|
32
36
  options[:name] = n
@@ -77,6 +81,9 @@ end
77
81
  begin
78
82
  ARGV.shift
79
83
  agent = MMS::Agent.new(options[:username], options[:apikey])
84
+ if options[:apiurl] then
85
+ agent.set_apiurl(options[:apiurl])
86
+ end
80
87
 
81
88
  results = agent.send action.sub('-', '_'), *ARGV
82
89
  results.select! { |resource| !resource.name.match(Regexp.new(options[:name])).nil? }
@@ -6,6 +6,27 @@ module MMS
6
6
  MMS::Client.instance.auth_setup(username, apikey)
7
7
  end
8
8
 
9
+ def set_apiurl(apiurl)
10
+ begin
11
+ url_info = URI(apiurl)
12
+ rescue URI::InvalidURIError
13
+ puts "Unable to parse given apiurl: #{apiurl}"
14
+ exit
15
+ end
16
+
17
+ # Split out version from URL path
18
+ path_parts = url_info.path.split '/'
19
+ api_version = path_parts.pop
20
+ url_info.path = path_parts.join '/'
21
+
22
+ # Update client singleton
23
+ MMS::Client.instance.api_protocol = url_info.scheme
24
+ MMS::Client.instance.api_host = url_info.host
25
+ MMS::Client.instance.api_port = url_info.port
26
+ MMS::Client.instance.api_path = url_info.path
27
+ MMS::Client.instance.api_version = api_version
28
+ end
29
+
9
30
  def groups
10
31
  group_list = []
11
32
  MMS::Client.instance.get('/groups').each do |group|
@@ -1,3 +1,3 @@
1
1
  module MMS
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mms-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cargo Media
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-09-20 00:00:00.000000000 Z
13
+ date: 2014-12-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: net-http-digest_auth
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 2.2.2
112
+ rubygems_version: 2.4.2
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: MongoDB MMS API client