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 +4 -4
 - data/README.md +1 -0
 - data/bin/mms-api +7 -0
 - data/lib/mms/agent.rb +21 -0
 - data/lib/mms/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8a105e082d9ced5d68e42aee67686335005933ee
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 075b3be253bb229508ea4782091d8fe5d0fdbd6a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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
         
     | 
    
        data/bin/mms-api
    CHANGED
    
    | 
         @@ -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? }
         
     | 
    
        data/lib/mms/agent.rb
    CHANGED
    
    | 
         @@ -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|
         
     | 
    
        data/lib/mms/version.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 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- 
     | 
| 
      
 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. 
     | 
| 
      
 112 
     | 
    
         
            +
            rubygems_version: 2.4.2
         
     | 
| 
       113 
113 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       114 
114 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       115 
115 
     | 
    
         
             
            summary: MongoDB MMS API client
         
     |