redhat_access_lib 1.0.6
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 +7 -0
 - data/Rakefile +9 -0
 - data/lib/api/api.rb +43 -0
 - data/lib/api/telemetry_api.rb +230 -0
 - data/lib/brokers/article.rb +24 -0
 - data/lib/brokers/attachment.rb +81 -0
 - data/lib/brokers/broker.rb +16 -0
 - data/lib/brokers/case.rb +145 -0
 - data/lib/brokers/comment.rb +69 -0
 - data/lib/brokers/entitlement.rb +15 -0
 - data/lib/brokers/group.rb +15 -0
 - data/lib/brokers/problem.rb +51 -0
 - data/lib/brokers/product.rb +15 -0
 - data/lib/brokers/solution.rb +22 -0
 - data/lib/brokers/symptom.rb +19 -0
 - data/lib/network/ftp_connection.rb +19 -0
 - data/lib/network/http_connection.rb +109 -0
 - data/lib/network/http_request.rb +55 -0
 - data/lib/network/http_resource.rb +175 -0
 - data/lib/redhat_access_lib.rb +111 -0
 - data/redhat_access_lib.gemspec +16 -0
 - metadata +99 -0
 
| 
         @@ -0,0 +1,111 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'pp'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative 'api/api'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require_relative 'api/telemetry_api'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            # auth_config = YAML::load(File.read(File.join(ENV['HOME'], 'portal-auth.yml')))
         
     | 
| 
      
 8 
     | 
    
         
            +
            # config = RedHatSupportLib::Network::Config.new
         
     | 
| 
      
 9 
     | 
    
         
            +
            # config.base_uri = 'https://api.access.redhat.com'
         
     | 
| 
      
 10 
     | 
    
         
            +
            # config.username=auth_config['username']
         
     | 
| 
      
 11 
     | 
    
         
            +
            # config.password = auth_config['password']
         
     | 
| 
      
 12 
     | 
    
         
            +
            # config.proxy= 'http://user1:password@localhost:3128/'
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            # config.log_location = '/tmp/support_lib_log.txt'
         
     | 
| 
      
 16 
     | 
    
         
            +
            # attachments_config = {:max_http_size => 2048, :ftp_host => '192.168.122.1',:ftp_remote_dir =>"/incoming"}
         
     | 
| 
      
 17 
     | 
    
         
            +
            # access = RedHatSupportLib::Api::API.new(config,attachments_config)
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            # solutions = access.solution_broker.search('JBOSS+SAM', 50);
         
     | 
| 
      
 21 
     | 
    
         
            +
            # pp solutions
         
     | 
| 
      
 22 
     | 
    
         
            +
            # # #Solutions tests
         
     | 
| 
      
 23 
     | 
    
         
            +
            # # if solutions
         
     | 
| 
      
 24 
     | 
    
         
            +
            # #   solutions.each do |solution|
         
     | 
| 
      
 25 
     | 
    
         
            +
            # #     pp access.solution_broker.get_solution(solution['id'])
         
     | 
| 
      
 26 
     | 
    
         
            +
            # #   end
         
     | 
| 
      
 27 
     | 
    
         
            +
            # # end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            # # #Articles tests
         
     | 
| 
      
 30 
     | 
    
         
            +
            # # articles = access.article_broker.search('JBOSS', 50);
         
     | 
| 
      
 31 
     | 
    
         
            +
            # # pp articles
         
     | 
| 
      
 32 
     | 
    
         
            +
            # # if articles
         
     | 
| 
      
 33 
     | 
    
         
            +
            # #   articles.each do |article|
         
     | 
| 
      
 34 
     | 
    
         
            +
            # #     pp access.article_broker.get_article(article['id'])
         
     | 
| 
      
 35 
     | 
    
         
            +
            # #   end
         
     | 
| 
      
 36 
     | 
    
         
            +
            # # end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            # # #Problems
         
     | 
| 
      
 39 
     | 
    
         
            +
            # # problems = access.problem_broker.diagnose_string("JBOSS NullPointerException")
         
     | 
| 
      
 40 
     | 
    
         
            +
            # # pp problems
         
     | 
| 
      
 41 
     | 
    
         
            +
            # # if problems
         
     | 
| 
      
 42 
     | 
    
         
            +
            # #   problems.each do |prob|
         
     | 
| 
      
 43 
     | 
    
         
            +
            # #     pp access.solution_broker.get_solution(prob[:solution_id])
         
     | 
| 
      
 44 
     | 
    
         
            +
            # #   end
         
     | 
| 
      
 45 
     | 
    
         
            +
            # # end
         
     | 
| 
      
 46 
     | 
    
         
            +
            # # file_probs = access.problem_broker.diagnose_file('/opt/jbdevstudio/runtimes/jboss-eap/standalone/log/boot.log')
         
     | 
| 
      
 47 
     | 
    
         
            +
            # # pp file_probs
         
     | 
| 
      
 48 
     | 
    
         
            +
            # # if file_probs
         
     | 
| 
      
 49 
     | 
    
         
            +
            # #   file_probs.each do |prob|
         
     | 
| 
      
 50 
     | 
    
         
            +
            # #     pp access.solution_broker.get_solution(prob[:solution_id])
         
     | 
| 
      
 51 
     | 
    
         
            +
            # #   end
         
     | 
| 
      
 52 
     | 
    
         
            +
            # # end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            # #---------------Cases--------------------------
         
     | 
| 
      
 55 
     | 
    
         
            +
            # #mycase  = access.case_broker.get("01017414")
         
     | 
| 
      
 56 
     | 
    
         
            +
            # #pp mycase
         
     | 
| 
      
 57 
     | 
    
         
            +
            # #filter = RedHatSupportLib::Brokers::CaseFilter.new
         
     | 
| 
      
 58 
     | 
    
         
            +
            # #keywords=[], include_closed=false, detail, group, start_date, end_date,
         
     | 
| 
      
 59 
     | 
    
         
            +
            # #              count, start, kwargs)
         
     | 
| 
      
 60 
     | 
    
         
            +
            # #mycases = access.case_broker.list([],true,true,nil,nil,nil,10,0,nil)
         
     | 
| 
      
 61 
     | 
    
         
            +
            # #pp mycases
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            # #created_case = access.case_broker.create("Subscription Asset Manager", 1.1, "Group test",
         
     | 
| 
      
 64 
     | 
    
         
            +
            # #                                        "Test Case created via Ruby, Group test","4 (Low)", '817')
         
     | 
| 
      
 65 
     | 
    
         
            +
            # #pp created_case
         
     | 
| 
      
 66 
     | 
    
         
            +
            # #if created_case
         
     | 
| 
      
 67 
     | 
    
         
            +
            # #  pp access.case_broker.get(created_case)
         
     | 
| 
      
 68 
     | 
    
         
            +
            # #end
         
     | 
| 
      
 69 
     | 
    
         
            +
            # #pp access.case_broker.list_severities
         
     | 
| 
      
 70 
     | 
    
         
            +
            # #pp access.case_broker.list_case_types
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
            # #updated = access.case_broker.update("01010070", "Red Hat HPC","5.4", nil,"Waiting on Customer","3 (Normal)")
         
     | 
| 
      
 74 
     | 
    
         
            +
            # #updated = access.case_broker.update("01010070", nil, nil,"Bug requiest 7","Waiting on Customer",nil, "Bug")
         
     | 
| 
      
 75 
     | 
    
         
            +
            # #pp updated
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            # #-----------------Symptoms------------------------
         
     | 
| 
      
 78 
     | 
    
         
            +
            # #file_symptoms = access.symptom_broker.diagnose_file('/opt/jbdevstudio/runtimes/jboss-eap/standalone/log/server.log.2013-12-19')
         
     | 
| 
      
 79 
     | 
    
         
            +
            # #pp file_symptoms
         
     | 
| 
      
 80 
     | 
    
         
            +
            # #
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            # #------------------Products-----------------------
         
     | 
| 
      
 83 
     | 
    
         
            +
            # #pp access.product_broker.list
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
            # #-------------------Groups-------------------------
         
     | 
| 
      
 87 
     | 
    
         
            +
            # #pp access.group_broker.list
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            # #-------------------Entitlements-------------------------
         
     | 
| 
      
 90 
     | 
    
         
            +
            # #pp access.entitlement_broker.list
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
            # #-------------------Comments--------------------------
         
     | 
| 
      
 93 
     | 
    
         
            +
            # #pp access.comment_broker.get("01010070", "a0aK0000003qnajIAA")
         
     | 
| 
      
 94 
     | 
    
         
            +
            # #pp access.comment_broker.add("01010070", "Added via ruby client, AGAIN", false, false)
         
     | 
| 
      
 95 
     | 
    
         
            +
            # #pp access.comment_broker.add("Comment added by ruby api 3",
         
     | 
| 
      
 96 
     | 
    
         
            +
            # #                              "01010069",
         
     | 
| 
      
 97 
     | 
    
         
            +
            # #                              false,
         
     | 
| 
      
 98 
     | 
    
         
            +
            # #                              false)
         
     | 
| 
      
 99 
     | 
    
         
            +
            # #pp access.comment_broker.list("01010069",nil,nil)
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
            # #------------------Attachments-------------------------
         
     | 
| 
      
 102 
     | 
    
         
            +
            # #pp access.attachment_broker.list("01015184","2014-01-24","2014-01-24")
         
     | 
| 
      
 103 
     | 
    
         
            +
            # attachment_list = access.attachment_broker.list("01465941",nil,nil,nil)
         
     | 
| 
      
 104 
     | 
    
         
            +
            # pp attachment_list
         
     | 
| 
      
 105 
     | 
    
         
            +
            # attachments = access.attachment_broker.add("01465941",
         
     | 
| 
      
 106 
     | 
    
         
            +
            #                                            false,
         
     | 
| 
      
 107 
     | 
    
         
            +
            #                                             "/tmp/dummy.txt",
         
     | 
| 
      
 108 
     | 
    
         
            +
            #                                             "description2")
         
     | 
| 
      
 109 
     | 
    
         
            +
            # pp attachments
         
     | 
| 
      
 110 
     | 
    
         
            +
            # attachment_list = access.attachment_broker.list("01465941",nil,nil,nil)
         
     | 
| 
      
 111 
     | 
    
         
            +
            # pp attachment_list
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Gem::Specification.new do |s|
         
     | 
| 
      
 2 
     | 
    
         
            +
              s.name = 'redhat_access_lib'
         
     | 
| 
      
 3 
     | 
    
         
            +
              s.version = '1.0.6'
         
     | 
| 
      
 4 
     | 
    
         
            +
              s.date = '2015-03-11'
         
     | 
| 
      
 5 
     | 
    
         
            +
              s.summary = "Rest Client for accessing Red Hat Support"
         
     | 
| 
      
 6 
     | 
    
         
            +
              s.description = "Rest Client for accessing Red Hat Support"
         
     | 
| 
      
 7 
     | 
    
         
            +
              s.authors = ["Lindani Phiri", "Rex White", "Ian Page Hands"]
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.email = 'lphiri@redhat.com'
         
     | 
| 
      
 9 
     | 
    
         
            +
              s.files = Dir['lib/**/*'] + ["redhat_access_lib.gemspec", "Rakefile"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              s.homepage ='http://rubygems.org/gems/redhat_support_lib'
         
     | 
| 
      
 11 
     | 
    
         
            +
              s.license = 'MIT'
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              s.add_runtime_dependency 'rest-client', '~> 1.6', '>= 1.6.3'
         
     | 
| 
      
 14 
     | 
    
         
            +
              s.add_development_dependency 'rake'
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,99 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: redhat_access_lib
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.6
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Lindani Phiri
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Rex White
         
     | 
| 
      
 9 
     | 
    
         
            +
            - Ian Page Hands
         
     | 
| 
      
 10 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 11 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 12 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2015-03-11 00:00:00.000000000 Z
         
     | 
| 
      
 14 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 15 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 16 
     | 
    
         
            +
              name: rest-client
         
     | 
| 
      
 17 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 18 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 19 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 20 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 21 
     | 
    
         
            +
                    version: '1.6'
         
     | 
| 
      
 22 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 23 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 24 
     | 
    
         
            +
                    version: 1.6.3
         
     | 
| 
      
 25 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 26 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 27 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 28 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 29 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 30 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 31 
     | 
    
         
            +
                    version: '1.6'
         
     | 
| 
      
 32 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 33 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 34 
     | 
    
         
            +
                    version: 1.6.3
         
     | 
| 
      
 35 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 36 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 37 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 38 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 39 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 40 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 41 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 42 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 43 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 44 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 45 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 46 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 47 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 48 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 49 
     | 
    
         
            +
            description: Rest Client for accessing Red Hat Support
         
     | 
| 
      
 50 
     | 
    
         
            +
            email: lphiri@redhat.com
         
     | 
| 
      
 51 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 52 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 53 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 54 
     | 
    
         
            +
            files:
         
     | 
| 
      
 55 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 56 
     | 
    
         
            +
            - lib/api/api.rb
         
     | 
| 
      
 57 
     | 
    
         
            +
            - lib/api/telemetry_api.rb
         
     | 
| 
      
 58 
     | 
    
         
            +
            - lib/brokers/article.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - lib/brokers/attachment.rb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - lib/brokers/broker.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - lib/brokers/case.rb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - lib/brokers/comment.rb
         
     | 
| 
      
 63 
     | 
    
         
            +
            - lib/brokers/entitlement.rb
         
     | 
| 
      
 64 
     | 
    
         
            +
            - lib/brokers/group.rb
         
     | 
| 
      
 65 
     | 
    
         
            +
            - lib/brokers/problem.rb
         
     | 
| 
      
 66 
     | 
    
         
            +
            - lib/brokers/product.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            - lib/brokers/solution.rb
         
     | 
| 
      
 68 
     | 
    
         
            +
            - lib/brokers/symptom.rb
         
     | 
| 
      
 69 
     | 
    
         
            +
            - lib/network/ftp_connection.rb
         
     | 
| 
      
 70 
     | 
    
         
            +
            - lib/network/http_connection.rb
         
     | 
| 
      
 71 
     | 
    
         
            +
            - lib/network/http_request.rb
         
     | 
| 
      
 72 
     | 
    
         
            +
            - lib/network/http_resource.rb
         
     | 
| 
      
 73 
     | 
    
         
            +
            - lib/redhat_access_lib.rb
         
     | 
| 
      
 74 
     | 
    
         
            +
            - redhat_access_lib.gemspec
         
     | 
| 
      
 75 
     | 
    
         
            +
            homepage: http://rubygems.org/gems/redhat_support_lib
         
     | 
| 
      
 76 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 77 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 78 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 79 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 80 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 81 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 82 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 83 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 84 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 85 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 86 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 87 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 88 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 89 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 90 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 91 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 92 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 93 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 94 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 95 
     | 
    
         
            +
            rubygems_version: 2.5.1
         
     | 
| 
      
 96 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 97 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 98 
     | 
    
         
            +
            summary: Rest Client for accessing Red Hat Support
         
     | 
| 
      
 99 
     | 
    
         
            +
            test_files: []
         
     |