rosette_api 1.1.0 → 1.1.1
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/request_builder.rb +17 -8
- data/lib/rosette_api.rb +1 -1
- data/tests/tests_spec.rb +14 -14
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a933956e30bc2d5f25da1185986b4d15213ed8c6
         | 
| 4 | 
            +
              data.tar.gz: d15ced2b62c5bf6c120fba6751e6bdd2b5719d0a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4ec8d75ea02529e81810389c1f2007c070118b063596394940bd594c4b021edbb477f2e9b4ead8359fa82ca370f7c4f3070fab017f434848ca26eb5f65a6ec11
         | 
| 7 | 
            +
              data.tar.gz: dc1bf7cac6789d0fe273a2081e8b53440037a2b55abfadf69df0f3a8857ae922d3e99b6c5d4f8cb85beca86c7d38e589a997da3258a60e04a0d9c8c32dd95186
         | 
    
        data/lib/request_builder.rb
    CHANGED
    
    | @@ -84,10 +84,15 @@ class RequestBuilder | |
| 84 84 | 
             
                post_body << "\r\n\r\n--#{boundary}--\r\n"
         | 
| 85 85 |  | 
| 86 86 | 
             
                # Create the HTTP objects
         | 
| 87 | 
            -
                 | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 87 | 
            +
                begin
         | 
| 88 | 
            +
                  uri = URI.parse @alternate_url
         | 
| 89 | 
            +
                  http = Net::HTTP.new uri.host, uri.port
         | 
| 90 | 
            +
                  http.use_ssl = uri.scheme == 'https'
         | 
| 91 | 
            +
                  request = Net::HTTP::Post.new uri.request_uri
         | 
| 92 | 
            +
                rescue
         | 
| 93 | 
            +
                  raise RosetteAPIError.new 'connectionError', 'Failed to establish connection with Rosette API server.'
         | 
| 94 | 
            +
                end
         | 
| 95 | 
            +
             | 
| 91 96 | 
             
                request.add_field 'Content-Type', "multipart/form-data; boundary=#{boundary}"
         | 
| 92 97 | 
             
                request.add_field 'X-RosetteAPI-Key', @user_key
         | 
| 93 98 | 
             
                request.add_field 'X-RosetteAPI-Binding', 'ruby'
         | 
| @@ -101,11 +106,15 @@ class RequestBuilder | |
| 101 106 | 
             
              #
         | 
| 102 107 | 
             
              # Returns JSON response or raises RosetteAPIError if encountered.
         | 
| 103 108 | 
             
              def send_get_request
         | 
| 104 | 
            -
                 | 
| 105 | 
            -
             | 
| 106 | 
            -
             | 
| 109 | 
            +
                begin
         | 
| 110 | 
            +
                  uri = URI.parse @alternate_url
         | 
| 111 | 
            +
                  http = Net::HTTP.new uri.host, uri.port
         | 
| 112 | 
            +
                  http.use_ssl = uri.scheme == 'https'
         | 
| 107 113 |  | 
| 108 | 
            -
             | 
| 114 | 
            +
                  request = Net::HTTP::Get.new uri.request_uri
         | 
| 115 | 
            +
                rescue
         | 
| 116 | 
            +
                  raise RosetteAPIError.new 'connectionError', 'Failed to establish connection with Rosette API server.'
         | 
| 117 | 
            +
                end
         | 
| 109 118 | 
             
                request['X-RosetteAPI-Key'] = @user_key
         | 
| 110 119 |  | 
| 111 120 | 
             
                self.get_response http, request
         | 
    
        data/lib/rosette_api.rb
    CHANGED
    
    | @@ -9,7 +9,7 @@ require_relative 'bad_request_format_error' | |
| 9 9 | 
             
            # This class allows you to access all Rosette API endpoints.
         | 
| 10 10 | 
             
            class RosetteAPI
         | 
| 11 11 | 
             
              # Version of Ruby binding
         | 
| 12 | 
            -
              BINDING_VERSION = '1.1. | 
| 12 | 
            +
              BINDING_VERSION = '1.1.1'
         | 
| 13 13 | 
             
              # Rosette API language endpoint
         | 
| 14 14 | 
             
              LANGUAGE_ENDPOINT = '/language'
         | 
| 15 15 | 
             
              # Rosette API morphology endpoint
         | 
    
        data/tests/tests_spec.rb
    CHANGED
    
    | @@ -18,7 +18,7 @@ describe RosetteAPI do | |
| 18 18 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 19 19 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 20 20 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 21 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 21 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 22 22 | 
             
                      to_return(status: 200, body: {'test': 'language'}.to_json, headers: {})
         | 
| 23 23 | 
             
                end
         | 
| 24 24 | 
             
                it 'test language' do
         | 
| @@ -55,7 +55,7 @@ describe RosetteAPI do | |
| 55 55 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 56 56 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 57 57 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 58 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 58 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 59 59 | 
             
                      to_return(status: 200, body: {'test': 'morphology/complete'}.to_json, headers: {})
         | 
| 60 60 | 
             
                end
         | 
| 61 61 | 
             
                it 'test morphology complete' do
         | 
| @@ -77,7 +77,7 @@ describe RosetteAPI do | |
| 77 77 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 78 78 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 79 79 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 80 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 80 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 81 81 | 
             
                      to_return(status: 200, body: {'test': 'morphology/compound-components'}.to_json, headers: {})
         | 
| 82 82 | 
             
                end
         | 
| 83 83 | 
             
                it 'test morphology compound components' do
         | 
| @@ -99,7 +99,7 @@ describe RosetteAPI do | |
| 99 99 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 100 100 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 101 101 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 102 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 102 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 103 103 | 
             
                      to_return(status: 200, body: {'test': 'morphology/han-readings'}.to_json, headers: {})
         | 
| 104 104 | 
             
                end
         | 
| 105 105 | 
             
                it 'test morphology han readings' do
         | 
| @@ -121,7 +121,7 @@ describe RosetteAPI do | |
| 121 121 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 122 122 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 123 123 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 124 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 124 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 125 125 | 
             
                      to_return(status: 200, body: {'test': 'morphology/parts-of-speech'}.to_json, headers: {})
         | 
| 126 126 | 
             
                end
         | 
| 127 127 | 
             
                it 'test morphology parts of speech' do
         | 
| @@ -143,7 +143,7 @@ describe RosetteAPI do | |
| 143 143 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 144 144 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 145 145 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 146 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 146 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 147 147 | 
             
                      to_return(status: 200, body: {'test': 'morphology/lemmas'}.to_json, headers: {})
         | 
| 148 148 | 
             
                end
         | 
| 149 149 | 
             
                it 'test morphology lemmas' do
         | 
| @@ -165,7 +165,7 @@ describe RosetteAPI do | |
| 165 165 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 166 166 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 167 167 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 168 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 168 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 169 169 | 
             
                      to_return(status: 200, body: {'test': 'entities'}.to_json, headers: {})
         | 
| 170 170 | 
             
                end
         | 
| 171 171 | 
             
                it 'test entities' do
         | 
| @@ -188,7 +188,7 @@ describe RosetteAPI do | |
| 188 188 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 189 189 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 190 190 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 191 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 191 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 192 192 | 
             
                      to_return(status: 200, body: {'test': 'entities/linked'}.to_json, headers: {})
         | 
| 193 193 | 
             
                end
         | 
| 194 194 | 
             
                it 'test entities linked' do
         | 
| @@ -218,7 +218,7 @@ describe RosetteAPI do | |
| 218 218 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 219 219 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 220 220 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 221 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 221 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 222 222 | 
             
                      to_return(status: 200, body: {'test': 'categories'}.to_json, headers: {})
         | 
| 223 223 | 
             
                end
         | 
| 224 224 | 
             
                it 'test categories' do
         | 
| @@ -240,7 +240,7 @@ describe RosetteAPI do | |
| 240 240 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 241 241 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 242 242 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 243 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 243 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 244 244 | 
             
                      to_return(status: 200, body: {'test': 'relationships'}.to_json, headers: {})
         | 
| 245 245 | 
             
                end
         | 
| 246 246 | 
             
                it 'test relationships' do
         | 
| @@ -262,7 +262,7 @@ describe RosetteAPI do | |
| 262 262 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 263 263 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 264 264 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 265 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 265 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 266 266 | 
             
                      to_return(status: 200, body: {'test': 'name-translation'}.to_json, headers: {})
         | 
| 267 267 | 
             
                end
         | 
| 268 268 | 
             
                it 'test name translation' do
         | 
| @@ -289,7 +289,7 @@ describe RosetteAPI do | |
| 289 289 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 290 290 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 291 291 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 292 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 292 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 293 293 | 
             
                      to_return(status: 200, body: {'test': 'name-similarity'}.to_json, headers: {})
         | 
| 294 294 | 
             
                end
         | 
| 295 295 | 
             
                it 'test name similarity' do
         | 
| @@ -325,7 +325,7 @@ describe RosetteAPI do | |
| 325 325 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 326 326 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 327 327 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 328 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 328 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 329 329 | 
             
                      to_return(status: 200, body: {'test': 'tokens'}.to_json, headers: {})
         | 
| 330 330 | 
             
                end
         | 
| 331 331 | 
             
                it 'test tokens' do
         | 
| @@ -347,7 +347,7 @@ describe RosetteAPI do | |
| 347 347 | 
             
                                        'User-Agent' => 'Ruby',
         | 
| 348 348 | 
             
                                        'X-Rosetteapi-Key' => '0123456789',
         | 
| 349 349 | 
             
                                        'X-Rosetteapi-Binding' => 'ruby',
         | 
| 350 | 
            -
                                        'X-Rosetteapi-Binding-Version' => '1.0 | 
| 350 | 
            +
                                        'X-Rosetteapi-Binding-Version' => '1.1.0'}).
         | 
| 351 351 | 
             
                      to_return(status: 200, body: {'test': 'sentences'}.to_json, headers: {})
         | 
| 352 352 | 
             
                end
         | 
| 353 353 | 
             
                it 'test sentences' do
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rosette_api
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.1. | 
| 4 | 
            +
              version: 1.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Basis Technology Corp
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016-06- | 
| 11 | 
            +
            date: 2016-06-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rubysl-securerandom
         |