osc_ruby 0.0.5 → 0.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 +4 -4
- data/lib/osc_ruby/client.rb +16 -16
- data/lib/osc_ruby/version.rb +1 -1
- data/spec/core/client_spec.rb +43 -0
- metadata +1 -2
- data/osc_ruby-0.0.3.gem +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a19c4503e2a134adf3015c3d27f1aaf7a4928ba6
         | 
| 4 | 
            +
              data.tar.gz: 8e5dc65d2b0acd9cc91a1029b8ae95784fdb1a7b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4d581c99f828f1134e9a5d7615b9c738f868f2be9e0722a44a65774c18e21c378248b473259e53922d03607870ca31ac5535c084852d511b48f4030990b77f52
         | 
| 7 | 
            +
              data.tar.gz: 9e4c10c0572672a729e083d5681115d91f3d6201b3bb3c61602b81f96c4a7fe47c72cd0a1a9a9f359ca9d955a3a0b5e3eb3d40913011afebca47752f2aceba92
         | 
    
        data/lib/osc_ruby/client.rb
    CHANGED
    
    | @@ -1,5 +1,6 @@ | |
| 1 1 | 
             
            require 'net/http'
         | 
| 2 2 | 
             
            require 'openssl'
         | 
| 3 | 
            +
            require 'json'
         | 
| 3 4 |  | 
| 4 5 | 
             
            require 'osc_ruby/version'
         | 
| 5 6 | 
             
            require 'osc_ruby/configuration'
         | 
| @@ -31,26 +32,25 @@ module OSCRuby | |
| 31 32 | 
             
            	    	end
         | 
| 32 33 | 
             
            	    end
         | 
| 33 34 |  | 
| 34 | 
            -
            		 | 
| 35 | 
            -
             | 
| 36 | 
            -
            		 | 
| 35 | 
            +
            		def self.basic_auth_url
         | 
| 36 | 
            +
            			uri = URI.parse(self.service_cloud_interface)
         | 
| 37 | 
            +
            		end
         | 
| 37 38 |  | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 39 | 
            +
            	    def self.service_cloud_interface
         | 
| 40 | 
            +
            	    	url = 'https://' + config.interface + '.custhelp.com/services/rest/connect/v1.3/'
         | 
| 41 | 
            +
            	    end
         | 
| 41 42 |  | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 43 | 
            +
            	    def self.connect(config,uri)
         | 
| 44 | 
            +
            	    	Net::HTTP.start(uri.host, uri.port,
         | 
| 45 | 
            +
            				:use_ssl => true) do |http|
         | 
| 45 46 |  | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 47 | 
            +
            				request = Net::HTTP::Get.new uri.request_uri
         | 
| 48 | 
            +
            				request.basic_auth config.username, config.password
         | 
| 48 49 |  | 
| 49 | 
            -
             | 
| 50 | 
            +
            				response = http.request request # Net::HTTPResponse object
         | 
| 50 51 |  | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
            	 #    end
         | 
| 52 | 
            +
            				json_response = JSON.parse(response.body)
         | 
| 53 | 
            +
            			end
         | 
| 54 | 
            +
            	    end
         | 
| 55 55 | 
             
            	end
         | 
| 56 56 | 
             
            end
         | 
    
        data/lib/osc_ruby/version.rb
    CHANGED
    
    
    
        data/spec/core/client_spec.rb
    CHANGED
    
    | @@ -4,6 +4,7 @@ describe OSCRuby::Client do | |
| 4 4 | 
             
            	subject { client }
         | 
| 5 5 |  | 
| 6 6 | 
             
            	context '#initialize' do
         | 
| 7 | 
            +
            		
         | 
| 7 8 | 
             
            		it 'should require a block' do
         | 
| 8 9 | 
             
            			expect { OSCRuby::Client.new }.to raise_error(ArgumentError)
         | 
| 9 10 | 
             
            		end
         | 
| @@ -54,4 +55,46 @@ describe OSCRuby::Client do | |
| 54 55 | 
             
            			end
         | 
| 55 56 | 
             
            		end
         | 
| 56 57 | 
             
            	end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
            	context '#service_cloud_interface' do
         | 
| 60 | 
            +
            		it 'should produce a valid url string' do
         | 
| 61 | 
            +
            			expect do
         | 
| 62 | 
            +
            				client = OSCRuby::Client.new do |config|
         | 
| 63 | 
            +
            					config.interface = 'test'
         | 
| 64 | 
            +
            					config.username = 'test_username'
         | 
| 65 | 
            +
            					config.password = 'test_password'
         | 
| 66 | 
            +
            				end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            				client.service_cloud_interface.should eq('https://test.custhelp.com/services/rest/connect/v1.3/')
         | 
| 69 | 
            +
            			end
         | 
| 70 | 
            +
            		end
         | 
| 71 | 
            +
            	end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
            	context '#basic_auth_url' do
         | 
| 74 | 
            +
            		it 'should produce a URI::HTTPS object' do
         | 
| 75 | 
            +
            			expect do
         | 
| 76 | 
            +
            				client = OSCRuby::Client.new do |config|
         | 
| 77 | 
            +
            					config.interface = 'test'
         | 
| 78 | 
            +
            					config.username = 'test_username'
         | 
| 79 | 
            +
            					config.password = 'test_password'
         | 
| 80 | 
            +
            				end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            				client.basic_auth_url.should_be a('URI::HTTPS')
         | 
| 83 | 
            +
            			end
         | 
| 84 | 
            +
            		end
         | 
| 85 | 
            +
            	end
         | 
| 86 | 
            +
             | 
| 87 | 
            +
            	context '#basic_auth_url' do
         | 
| 88 | 
            +
            		it 'should produce a JSON Response' do
         | 
| 89 | 
            +
            			expect do
         | 
| 90 | 
            +
            				client = OSCRuby::Client.new do |config|
         | 
| 91 | 
            +
            					config.interface = 'qsee--tst'
         | 
| 92 | 
            +
            					config.username = ENV['OSC_ADMIN']
         | 
| 93 | 
            +
            					config.password = ENV['OSC_PASSWORD']
         | 
| 94 | 
            +
            				end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
            				client.connect.should_be a('String')
         | 
| 97 | 
            +
            			end
         | 
| 98 | 
            +
            		end
         | 
| 99 | 
            +
            	end
         | 
| 57 100 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: osc_ruby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Rajan Davis
         | 
| @@ -71,7 +71,6 @@ files: | |
| 71 71 | 
             
            - lib/osc_ruby/client.rb
         | 
| 72 72 | 
             
            - lib/osc_ruby/configuration.rb
         | 
| 73 73 | 
             
            - lib/osc_ruby/version.rb
         | 
| 74 | 
            -
            - osc_ruby-0.0.3.gem
         | 
| 75 74 | 
             
            - osc_ruby.gemspec
         | 
| 76 75 | 
             
            - spec/core/client_spec.rb
         | 
| 77 76 | 
             
            - spec/core/configuration_spec.rb
         | 
    
        data/osc_ruby-0.0.3.gem
    DELETED
    
    | Binary file |