rest-client-wrapper 3.0.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 +7 -0
 - data/README.md +484 -0
 - data/lib/rest_client_wrapper.rb +33 -0
 - data/lib/rest_client_wrapper/authenticators/auth.rb +30 -0
 - data/lib/rest_client_wrapper/authenticators/basic.rb +45 -0
 - data/lib/rest_client_wrapper/authenticators/custom.rb +61 -0
 - data/lib/rest_client_wrapper/authenticators/oauth.rb +90 -0
 - data/lib/rest_client_wrapper/authenticators/token.rb +43 -0
 - data/lib/rest_client_wrapper/constants.rb +28 -0
 - data/lib/rest_client_wrapper/exceptions.rb +37 -0
 - data/lib/rest_client_wrapper/http.rb +66 -0
 - data/lib/rest_client_wrapper/paginators/echo.rb +67 -0
 - data/lib/rest_client_wrapper/paginators/echo_paginator.rb +67 -0
 - data/lib/rest_client_wrapper/paginators/header_link.rb +78 -0
 - data/lib/rest_client_wrapper/paginators/header_link_paginator.rb +78 -0
 - data/lib/rest_client_wrapper/paginators/paginate.rb +32 -0
 - data/lib/rest_client_wrapper/request.rb +75 -0
 - data/lib/rest_client_wrapper/response.rb +34 -0
 - data/lib/rest_client_wrapper/rest_client.rb +178 -0
 - data/lib/rest_client_wrapper/version.rb +23 -0
 - data/rest-client-wrapper.gemspec +51 -0
 - data/spec/authenticators/oauth_spec.rb +103 -0
 - data/spec/factories/request.rb +48 -0
 - data/spec/factories/response.rb +47 -0
 - data/spec/request_spec.rb +185 -0
 - data/spec/rest_client_spec.rb +249 -0
 - data/spec/spec_helper.rb +75 -0
 - data/spec/support/factory_bot.rb +28 -0
 - data/spec/support/stub_helper.rb +20 -0
 - metadata +216 -0
 
| 
         @@ -0,0 +1,249 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Copyright (C) 2019 The University of Adelaide
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            # This file is part of Rest-Client-Wrapper.
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # Rest-Client-Wrapper is free software: you can redistribute it and/or modify
         
     | 
| 
      
 6 
     | 
    
         
            +
            # it under the terms of the GNU General Public License as published by
         
     | 
| 
      
 7 
     | 
    
         
            +
            # the Free Software Foundation, either version 3 of the License, or
         
     | 
| 
      
 8 
     | 
    
         
            +
            # (at your option) any later version.
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            # Rest-Client-Wrapper is distributed in the hope that it will be useful,
         
     | 
| 
      
 11 
     | 
    
         
            +
            # but WITHOUT ANY WARRANTY; without even the implied warranty of
         
     | 
| 
      
 12 
     | 
    
         
            +
            # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
         
     | 
| 
      
 13 
     | 
    
         
            +
            # GNU General Public License for more details.
         
     | 
| 
      
 14 
     | 
    
         
            +
            #
         
     | 
| 
      
 15 
     | 
    
         
            +
            # You should have received a copy of the GNU General Public License
         
     | 
| 
      
 16 
     | 
    
         
            +
            # along with Rest-Client-Wrapper. If not, see <http://www.gnu.org/licenses/>.
         
     | 
| 
      
 17 
     | 
    
         
            +
            #
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            require "spec_helper"
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            # RestClientWrapper
         
     | 
| 
      
 22 
     | 
    
         
            +
            module RestClientWrapper # rubocop:disable Metrics/ModuleLength
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              describe RestClient do
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                before(:context) do
         
     | 
| 
      
 27 
     | 
    
         
            +
                  @api_url = URI.parse("http://fake_api_site.com")
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @rest_client = RestClient.new({ host: @api_url.to_s })
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  @client_id = "client_id"
         
     | 
| 
      
 31 
     | 
    
         
            +
                  @client_secret = "client_secret"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  @api_token_uri = URI.parse("http://fake_oauth_token.com/token_url_path")
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  @oauth_client = RestClient.new({ host: @api_url.to_s })
         
     | 
| 
      
 35 
     | 
    
         
            +
                  @oauth_client.authenticator = Authenticator::Oauth.new(
         
     | 
| 
      
 36 
     | 
    
         
            +
                    {
         
     | 
| 
      
 37 
     | 
    
         
            +
                      site:           "#{ @api_token_uri.scheme }://#{ @api_token_uri.host }",
         
     | 
| 
      
 38 
     | 
    
         
            +
                      token_url_path: @api_token_uri.path,
         
     | 
| 
      
 39 
     | 
    
         
            +
                      client_id:      @client_id,
         
     | 
| 
      
 40 
     | 
    
         
            +
                      client_secret:  @client_secret
         
     | 
| 
      
 41 
     | 
    
         
            +
                    }
         
     | 
| 
      
 42 
     | 
    
         
            +
                  )
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                describe "#execute" do
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  before(:example) do
         
     | 
| 
      
 48 
     | 
    
         
            +
                    @course_id = "fake_course_id"
         
     | 
| 
      
 49 
     | 
    
         
            +
                    @uri = "/api/v1/courses/#{ @course_id }"
         
     | 
| 
      
 50 
     | 
    
         
            +
                    @rest_client.authenticator = Authenticator::Basic.new({ username: "username", password: "password" })
         
     | 
| 
      
 51 
     | 
    
         
            +
                    request = FactoryBot.build(:request, { body: {}, headers: FactoryBot.build(:request_headers, { host: @api_url.host }).to_h }).to_h
         
     | 
| 
      
 52 
     | 
    
         
            +
                    response = FactoryBot.build(:response).to_h
         
     | 
| 
      
 53 
     | 
    
         
            +
                    @api_request = stub_request(:get, "#{ @api_url }#{ @uri }").with(request).to_return(response)
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                  context "when the request is valid" do
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                    it "will return a valid response" do
         
     | 
| 
      
 59 
     | 
    
         
            +
                      request = Request.new({ http_method: :get, uri: "/api/v1/courses/%<course_id>s" })
         
     | 
| 
      
 60 
     | 
    
         
            +
                      request.segment_params = { course_id: @course_id }
         
     | 
| 
      
 61 
     | 
    
         
            +
                      @rest_client.execute({ request: request })
         
     | 
| 
      
 62 
     | 
    
         
            +
                      expect(@api_request).to have_been_requested
         
     | 
| 
      
 63 
     | 
    
         
            +
                      expect(@api_request).to have_been_requested.times(1)
         
     | 
| 
      
 64 
     | 
    
         
            +
                    end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                  end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                  context "when put request with query params and payload" do
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                    before(:example) do
         
     | 
| 
      
 71 
     | 
    
         
            +
                      @request = Request.new({ http_method: :put, uri: "/api/v1/courses/%<course_id>s" })
         
     | 
| 
      
 72 
     | 
    
         
            +
                      @request.segment_params = { course_id: @course_id }
         
     | 
| 
      
 73 
     | 
    
         
            +
                      @request.payload = { id: "value" }
         
     | 
| 
      
 74 
     | 
    
         
            +
                      @request.query_params = { param: "value" }
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                      @mock_request = FactoryBot.build(:request, { body: @request.payload, headers: FactoryBot.build(:request_headers, { host: @api_url.host }).to_h }).to_h
         
     | 
| 
      
 77 
     | 
    
         
            +
                      @response = FactoryBot.build(:response).to_h
         
     | 
| 
      
 78 
     | 
    
         
            +
                    end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                    it "has query string params in URL and payload as json in body" do
         
     | 
| 
      
 81 
     | 
    
         
            +
                      @api_request = stub_request(:put, "#{ @api_url }#{ @uri }?#{ @request.query_params.to_query }").with(@mock_request).to_return(@response)
         
     | 
| 
      
 82 
     | 
    
         
            +
                      @rest_client.execute({ request: @request })
         
     | 
| 
      
 83 
     | 
    
         
            +
                      expect(@api_request).to have_been_requested
         
     | 
| 
      
 84 
     | 
    
         
            +
                    end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                  end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                  context "when access token is no longer valid/expired" do
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                    before(:example) do
         
     | 
| 
      
 91 
     | 
    
         
            +
                      @uri = "/api/v1/courses/course_id"
         
     | 
| 
      
 92 
     | 
    
         
            +
                      @requests = []
         
     | 
| 
      
 93 
     | 
    
         
            +
                      request = FactoryBot.build(:request, { body: {}, headers: FactoryBot.build(:request_headers, { host: @api_url.host }).to_h }).to_h
         
     | 
| 
      
 94 
     | 
    
         
            +
                      # Respond with unauthorized error to force reauth
         
     | 
| 
      
 95 
     | 
    
         
            +
                      response = FactoryBot.build(:response, { status: Rack::Utils::SYMBOL_TO_STATUS_CODE[:unauthorized] }).to_h
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                      @requests << stub_request(:get, "#{ @api_url }#{ @uri }").with(request).to_return(response)
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                      oauth_request = FactoryBot.build(:oauth_token_request, { headers: FactoryBot.build(:request_headers, { host: @api_token_uri.host }).to_h }).to_h
         
     | 
| 
      
 100 
     | 
    
         
            +
                      oauth_response = FactoryBot.build(:auth_token_response).to_h
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                      @requests << stub_request(:post, @api_token_uri.to_s).with(oauth_request).to_return(oauth_response)
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
                      response = FactoryBot.build(:response, { status: Rack::Utils::SYMBOL_TO_STATUS_CODE[:ok] }).to_h
         
     | 
| 
      
 105 
     | 
    
         
            +
                      @requests << stub_request(:get, "#{ @api_url }#{ @uri }").with(request).to_return(response)
         
     | 
| 
      
 106 
     | 
    
         
            +
                    end
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
                    it "will get a new access_token" do
         
     | 
| 
      
 109 
     | 
    
         
            +
                      request = Request.new({ http_method: :get, uri: @uri })
         
     | 
| 
      
 110 
     | 
    
         
            +
                      request.segment_params = { course_id: @course_id }
         
     | 
| 
      
 111 
     | 
    
         
            +
                      @oauth_client.execute({ request: request })
         
     | 
| 
      
 112 
     | 
    
         
            +
                      @requests.each do |req|
         
     | 
| 
      
 113 
     | 
    
         
            +
                        expect(req).to have_been_requested.times(1)
         
     | 
| 
      
 114 
     | 
    
         
            +
                      end
         
     | 
| 
      
 115 
     | 
    
         
            +
                    end
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                  end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
                  context "when there's a response with a status code not in the retry list" do
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
                    before(:example) do
         
     | 
| 
      
 122 
     | 
    
         
            +
                      WebMock.reset_executed_requests!
         
     | 
| 
      
 123 
     | 
    
         
            +
                      request = FactoryBot.build(:request, { body: {}, headers: FactoryBot.build(:request_headers, { host: @api_url.host }).to_h }).to_h
         
     | 
| 
      
 124 
     | 
    
         
            +
                      response = FactoryBot.build(:response, { status: Rack::Utils::SYMBOL_TO_STATUS_CODE[:internal_server_error] }).to_h
         
     | 
| 
      
 125 
     | 
    
         
            +
                      @api_request = stub_request(:get, "#{ @api_url }#{ @uri }").with(request).to_return(response)
         
     | 
| 
      
 126 
     | 
    
         
            +
                    end
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
                    it "will raise an exception" do
         
     | 
| 
      
 129 
     | 
    
         
            +
                      request = Request.new({ http_method: :get, uri: "/api/v1/courses/%<course_id>s" })
         
     | 
| 
      
 130 
     | 
    
         
            +
                      request.segment_params = { course_id: @course_id }
         
     | 
| 
      
 131 
     | 
    
         
            +
                      expect { @rest_client.execute({ request: request }) }.to raise_exception(RestClientError)
         
     | 
| 
      
 132 
     | 
    
         
            +
                      expect(@api_request).to have_been_requested.times(1)
         
     | 
| 
      
 133 
     | 
    
         
            +
                    end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                  end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
                  context "when there's a response status code is 429 (too many requests)" do
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                    before(:example) do
         
     | 
| 
      
 140 
     | 
    
         
            +
                      WebMock.reset_executed_requests!
         
     | 
| 
      
 141 
     | 
    
         
            +
                      request = FactoryBot.build(:request, { body: {}, headers: FactoryBot.build(:request_headers, { host: @api_url.host }).to_h }).to_h
         
     | 
| 
      
 142 
     | 
    
         
            +
                      response = FactoryBot.build(:response, { status: Rack::Utils::SYMBOL_TO_STATUS_CODE[:too_many_requests] }).to_h
         
     | 
| 
      
 143 
     | 
    
         
            +
                      @api_request = stub_request(:get, "#{ @api_url }#{ @uri }").with(request).to_return(response)
         
     | 
| 
      
 144 
     | 
    
         
            +
                    end
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
                    it "will retry three times than raise an exception" do
         
     | 
| 
      
 147 
     | 
    
         
            +
                      request = Request.new({ http_method: :get, uri: "/api/v1/courses/%<course_id>s" })
         
     | 
| 
      
 148 
     | 
    
         
            +
                      request.segment_params = { course_id: @course_id }
         
     | 
| 
      
 149 
     | 
    
         
            +
                      expect { @rest_client.execute({ request: request }) }.to raise_exception(RestClientError)
         
     | 
| 
      
 150 
     | 
    
         
            +
                      expect(@api_request).to have_been_requested.times(4) # initial request + 3 retries
         
     | 
| 
      
 151 
     | 
    
         
            +
                    end
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
                  end
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
                end
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                describe "#make_request" do
         
     | 
| 
      
 158 
     | 
    
         
            +
             
     | 
| 
      
 159 
     | 
    
         
            +
                  before(:example) do
         
     | 
| 
      
 160 
     | 
    
         
            +
                    WebMock.reset_executed_requests!
         
     | 
| 
      
 161 
     | 
    
         
            +
                    @course_id = "fake_course_id"
         
     | 
| 
      
 162 
     | 
    
         
            +
                    @uri = "/api/v1/courses/#{ @course_id }"
         
     | 
| 
      
 163 
     | 
    
         
            +
                    @rest_client.authenticator = Authenticator::Basic.new({ username: "username", password: "password" })
         
     | 
| 
      
 164 
     | 
    
         
            +
                    request = FactoryBot.build(:request, { body: {}, headers: FactoryBot.build(:request_headers, { host: @api_url.host }).to_h }).to_h
         
     | 
| 
      
 165 
     | 
    
         
            +
                    response = FactoryBot.build(:response).to_h
         
     | 
| 
      
 166 
     | 
    
         
            +
                    @api_request = stub_request(:get, "#{ @api_url }#{ @uri }").with(request).to_return(response)
         
     | 
| 
      
 167 
     | 
    
         
            +
                  end
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
                  context "when the request is valid" do
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
                    it "will return a valid response" do
         
     | 
| 
      
 172 
     | 
    
         
            +
                      @rest_client.make_request({ http_method: :get, uri: @uri })
         
     | 
| 
      
 173 
     | 
    
         
            +
                      expect(@api_request).to have_been_requested
         
     | 
| 
      
 174 
     | 
    
         
            +
                      expect(@api_request).to have_been_requested.times(1)
         
     | 
| 
      
 175 
     | 
    
         
            +
                    end
         
     | 
| 
      
 176 
     | 
    
         
            +
             
     | 
| 
      
 177 
     | 
    
         
            +
                  end
         
     | 
| 
      
 178 
     | 
    
         
            +
             
     | 
| 
      
 179 
     | 
    
         
            +
                end
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
                describe "#get_all_pages" do
         
     | 
| 
      
 182 
     | 
    
         
            +
             
     | 
| 
      
 183 
     | 
    
         
            +
                  before(:example) do
         
     | 
| 
      
 184 
     | 
    
         
            +
                    WebMock.reset_executed_requests!
         
     | 
| 
      
 185 
     | 
    
         
            +
                    @uri = "/api/v1/courses/enrollments"
         
     | 
| 
      
 186 
     | 
    
         
            +
                    @per_page = 500
         
     | 
| 
      
 187 
     | 
    
         
            +
                    @requests = []
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
                    @rest_client.authenticator = Authenticator::Basic.new({ username: "username", password: "password" })
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
                    # Stubing requests and responses for pagination calls
         
     | 
| 
      
 192 
     | 
    
         
            +
                    1.upto(4) do |page_number|
         
     | 
| 
      
 193 
     | 
    
         
            +
                      response = FactoryBot.build(:paginated_response).to_h
         
     | 
| 
      
 194 
     | 
    
         
            +
                      # Add "next" link header for all responses except the last one. (i.e. so that we're only processing 4 pages)
         
     | 
| 
      
 195 
     | 
    
         
            +
                      response[:headers][:link] = "<#{ @api_url }#{ @uri }?page=#{ page_number + 1 }&per_page=#{ @per_page }>; rel=\"next\"" if page_number < 4
         
     | 
| 
      
 196 
     | 
    
         
            +
                      request = FactoryBot.build(:request, { body: { per_page: @per_page, page: page_number }, headers: FactoryBot.build(:request_headers, { host: @api_url.host }).to_h }).to_h
         
     | 
| 
      
 197 
     | 
    
         
            +
                      api_request = stub_request(:get, "#{ @api_url }#{ @uri }").with(request).to_return(response)
         
     | 
| 
      
 198 
     | 
    
         
            +
                      @requests << api_request
         
     | 
| 
      
 199 
     | 
    
         
            +
                    end
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
                  end
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
                  context "when a pagination request is made" do
         
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
      
 205 
     | 
    
         
            +
                    it "will recursively make pagination requests until there's no page left" do
         
     | 
| 
      
 206 
     | 
    
         
            +
                      skip "TODO: move to Paginator"
         
     | 
| 
      
 207 
     | 
    
         
            +
                      @rest_client.get_all_pages({ http_method: :get, uri: @uri, payload: { per_page: @per_page } })
         
     | 
| 
      
 208 
     | 
    
         
            +
                      @requests.each do |request|
         
     | 
| 
      
 209 
     | 
    
         
            +
                        expect(request).to have_been_requested.times(1)
         
     | 
| 
      
 210 
     | 
    
         
            +
                      end
         
     | 
| 
      
 211 
     | 
    
         
            +
             
     | 
| 
      
 212 
     | 
    
         
            +
                    end
         
     | 
| 
      
 213 
     | 
    
         
            +
             
     | 
| 
      
 214 
     | 
    
         
            +
                  end
         
     | 
| 
      
 215 
     | 
    
         
            +
             
     | 
| 
      
 216 
     | 
    
         
            +
                end
         
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
                describe "#_validate_request" do
         
     | 
| 
      
 219 
     | 
    
         
            +
             
     | 
| 
      
 220 
     | 
    
         
            +
                  before(:example) do
         
     | 
| 
      
 221 
     | 
    
         
            +
                    @request = Request.new({ http_method: :get, uri: "/public/api/v1/users/%<user_id>s" })
         
     | 
| 
      
 222 
     | 
    
         
            +
                  end
         
     | 
| 
      
 223 
     | 
    
         
            +
             
     | 
| 
      
 224 
     | 
    
         
            +
                  context "when URI is missing a segments parameter" do
         
     | 
| 
      
 225 
     | 
    
         
            +
             
     | 
| 
      
 226 
     | 
    
         
            +
                    it "will raise ArgumentError" do
         
     | 
| 
      
 227 
     | 
    
         
            +
                      expect { @rest_client.send(:_validate_request, @request) }.to raise_error(ArgumentError)
         
     | 
| 
      
 228 
     | 
    
         
            +
                    end
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
                  end
         
     | 
| 
      
 231 
     | 
    
         
            +
             
     | 
| 
      
 232 
     | 
    
         
            +
                  context "when all segment parameters are present for URI" do
         
     | 
| 
      
 233 
     | 
    
         
            +
             
     | 
| 
      
 234 
     | 
    
         
            +
                    before(:example) do
         
     | 
| 
      
 235 
     | 
    
         
            +
                      @request = Request.new({ http_method: :get, uri: "/public/api/v1/courses/%<course_id>s/user/%<user_id>s" })
         
     | 
| 
      
 236 
     | 
    
         
            +
                      @request.segment_params = { user_id: "user_id", course_id: "course_id" }
         
     | 
| 
      
 237 
     | 
    
         
            +
                    end
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
                    it "return not raise an error" do
         
     | 
| 
      
 240 
     | 
    
         
            +
                      expect { @rest_client.send(:_validate_request, @request) }.not_to raise_error
         
     | 
| 
      
 241 
     | 
    
         
            +
                    end
         
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
      
 243 
     | 
    
         
            +
                  end
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
                end
         
     | 
| 
      
 246 
     | 
    
         
            +
             
     | 
| 
      
 247 
     | 
    
         
            +
              end
         
     | 
| 
      
 248 
     | 
    
         
            +
             
     | 
| 
      
 249 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,75 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Copyright (C) 2019 The University of Adelaide
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            # This file is part of Rest-Client-Wrapper.
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # Rest-Client-Wrapper is free software: you can redistribute it and/or modify
         
     | 
| 
      
 6 
     | 
    
         
            +
            # it under the terms of the GNU General Public License as published by
         
     | 
| 
      
 7 
     | 
    
         
            +
            # the Free Software Foundation, either version 3 of the License, or
         
     | 
| 
      
 8 
     | 
    
         
            +
            # (at your option) any later version.
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            # Rest-Client-Wrapper is distributed in the hope that it will be useful,
         
     | 
| 
      
 11 
     | 
    
         
            +
            # but WITHOUT ANY WARRANTY; without even the implied warranty of
         
     | 
| 
      
 12 
     | 
    
         
            +
            # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
         
     | 
| 
      
 13 
     | 
    
         
            +
            # GNU General Public License for more details.
         
     | 
| 
      
 14 
     | 
    
         
            +
            #
         
     | 
| 
      
 15 
     | 
    
         
            +
            # You should have received a copy of the GNU General Public License
         
     | 
| 
      
 16 
     | 
    
         
            +
            # along with Rest-Client-Wrapper. If not, see <http://www.gnu.org/licenses/>.
         
     | 
| 
      
 17 
     | 
    
         
            +
            #
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            require "pry"
         
     | 
| 
      
 20 
     | 
    
         
            +
            require "rest_client_wrapper/authenticators/basic"
         
     | 
| 
      
 21 
     | 
    
         
            +
            require "rest_client_wrapper/authenticators/custom"
         
     | 
| 
      
 22 
     | 
    
         
            +
            require "rest_client_wrapper/authenticators/oauth"
         
     | 
| 
      
 23 
     | 
    
         
            +
            require "rest_client_wrapper/rest_client"
         
     | 
| 
      
 24 
     | 
    
         
            +
            require "rest_client_wrapper/request"
         
     | 
| 
      
 25 
     | 
    
         
            +
            require "rest_client_wrapper/response"
         
     | 
| 
      
 26 
     | 
    
         
            +
            require "support/factory_bot"
         
     | 
| 
      
 27 
     | 
    
         
            +
            require "webmock/rspec"
         
     | 
| 
      
 28 
     | 
    
         
            +
            require "faker"
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            # This file was generated by the `rspec --init` command. Conventionally, all
         
     | 
| 
      
 31 
     | 
    
         
            +
            # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
         
     | 
| 
      
 32 
     | 
    
         
            +
            # The generated `.rspec` file contains `--require spec_helper` which will cause
         
     | 
| 
      
 33 
     | 
    
         
            +
            # this file to always be loaded, without a need to explicitly require it in any
         
     | 
| 
      
 34 
     | 
    
         
            +
            # files.
         
     | 
| 
      
 35 
     | 
    
         
            +
            #
         
     | 
| 
      
 36 
     | 
    
         
            +
            # Given that it is always loaded, you are encouraged to keep this file as
         
     | 
| 
      
 37 
     | 
    
         
            +
            # light-weight as possible. Requiring heavyweight dependencies from this file
         
     | 
| 
      
 38 
     | 
    
         
            +
            # will add to the boot time of your test suite on EVERY test run, even for an
         
     | 
| 
      
 39 
     | 
    
         
            +
            # individual file that may not need all of that loaded. Instead, consider making
         
     | 
| 
      
 40 
     | 
    
         
            +
            # a separate helper file that requires the additional dependencies and performs
         
     | 
| 
      
 41 
     | 
    
         
            +
            # the additional setup, and require it from the spec files that actually need
         
     | 
| 
      
 42 
     | 
    
         
            +
            # it.
         
     | 
| 
      
 43 
     | 
    
         
            +
            #
         
     | 
| 
      
 44 
     | 
    
         
            +
            # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
         
     | 
| 
      
 45 
     | 
    
         
            +
            RSpec.configure do |config|
         
     | 
| 
      
 46 
     | 
    
         
            +
              # rspec-expectations config goes here. You can use an alternate
         
     | 
| 
      
 47 
     | 
    
         
            +
              # assertion/expectation library such as wrong or the stdlib/minitest
         
     | 
| 
      
 48 
     | 
    
         
            +
              # assertions if you prefer.
         
     | 
| 
      
 49 
     | 
    
         
            +
              config.expect_with :rspec do |expectations|
         
     | 
| 
      
 50 
     | 
    
         
            +
                # This option will default to `true` in RSpec 4. It makes the `description`
         
     | 
| 
      
 51 
     | 
    
         
            +
                # and `failure_message` of custom matchers include text for helper methods
         
     | 
| 
      
 52 
     | 
    
         
            +
                # defined using `chain`, e.g.:
         
     | 
| 
      
 53 
     | 
    
         
            +
                #     be_bigger_than(2).and_smaller_than(4).description
         
     | 
| 
      
 54 
     | 
    
         
            +
                #     # => "be bigger than 2 and smaller than 4"
         
     | 
| 
      
 55 
     | 
    
         
            +
                # ...rather than:
         
     | 
| 
      
 56 
     | 
    
         
            +
                #     # => "be bigger than 2"
         
     | 
| 
      
 57 
     | 
    
         
            +
                expectations.include_chain_clauses_in_custom_matcher_descriptions = true
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
              # rspec-mocks config goes here. You can use an alternate test double
         
     | 
| 
      
 61 
     | 
    
         
            +
              # library (such as bogus or mocha) by changing the `mock_with` option here.
         
     | 
| 
      
 62 
     | 
    
         
            +
              config.mock_with :rspec do |mocks|
         
     | 
| 
      
 63 
     | 
    
         
            +
                # Prevents you from mocking or stubbing a method that does not exist on
         
     | 
| 
      
 64 
     | 
    
         
            +
                # a real object. This is generally recommended, and will default to
         
     | 
| 
      
 65 
     | 
    
         
            +
                # `true` in RSpec 4.
         
     | 
| 
      
 66 
     | 
    
         
            +
                mocks.verify_partial_doubles = true
         
     | 
| 
      
 67 
     | 
    
         
            +
              end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
              # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
         
     | 
| 
      
 70 
     | 
    
         
            +
              # have no way to turn it off -- the option exists only for backwards
         
     | 
| 
      
 71 
     | 
    
         
            +
              # compatibility in RSpec 3). It causes shared context metadata to be
         
     | 
| 
      
 72 
     | 
    
         
            +
              # inherited by the metadata hash of host groups and examples, rather than
         
     | 
| 
      
 73 
     | 
    
         
            +
              # triggering implicit auto-inclusion in groups with matching metadata.
         
     | 
| 
      
 74 
     | 
    
         
            +
              config.shared_context_metadata_behavior = :apply_to_host_groups
         
     | 
| 
      
 75 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Copyright (C) 2019 The University of Adelaide
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            # This file is part of Rest-Client-Wrapper.
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # Rest-Client-Wrapper is free software: you can redistribute it and/or modify
         
     | 
| 
      
 6 
     | 
    
         
            +
            # it under the terms of the GNU General Public License as published by
         
     | 
| 
      
 7 
     | 
    
         
            +
            # the Free Software Foundation, either version 3 of the License, or
         
     | 
| 
      
 8 
     | 
    
         
            +
            # (at your option) any later version.
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            # Rest-Client-Wrapper is distributed in the hope that it will be useful,
         
     | 
| 
      
 11 
     | 
    
         
            +
            # but WITHOUT ANY WARRANTY; without even the implied warranty of
         
     | 
| 
      
 12 
     | 
    
         
            +
            # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
         
     | 
| 
      
 13 
     | 
    
         
            +
            # GNU General Public License for more details.
         
     | 
| 
      
 14 
     | 
    
         
            +
            #
         
     | 
| 
      
 15 
     | 
    
         
            +
            # You should have received a copy of the GNU General Public License
         
     | 
| 
      
 16 
     | 
    
         
            +
            # along with Rest-Client-Wrapper. If not, see <http://www.gnu.org/licenses/>.
         
     | 
| 
      
 17 
     | 
    
         
            +
            #
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            require "factory_bot"
         
     | 
| 
      
 20 
     | 
    
         
            +
            require_relative "stub_helper"
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            RSpec.configure do |config|
         
     | 
| 
      
 23 
     | 
    
         
            +
              config.include FactoryBot::Syntax::Methods
         
     | 
| 
      
 24 
     | 
    
         
            +
              config.before(:suite) do
         
     | 
| 
      
 25 
     | 
    
         
            +
                FactoryBot.find_definitions
         
     | 
| 
      
 26 
     | 
    
         
            +
                config.include_context "stub_helper"
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Copyright (C) 2019 The University of Adelaide
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            # This file is part of Rest-Client-Wrapper.
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # Rest-Client-Wrapper is free software: you can redistribute it and/or modify
         
     | 
| 
      
 6 
     | 
    
         
            +
            # it under the terms of the GNU General Public License as published by
         
     | 
| 
      
 7 
     | 
    
         
            +
            # the Free Software Foundation, either version 3 of the License, or
         
     | 
| 
      
 8 
     | 
    
         
            +
            # (at your option) any later version.
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            # Rest-Client-Wrapper is distributed in the hope that it will be useful,
         
     | 
| 
      
 11 
     | 
    
         
            +
            # but WITHOUT ANY WARRANTY; without even the implied warranty of
         
     | 
| 
      
 12 
     | 
    
         
            +
            # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
         
     | 
| 
      
 13 
     | 
    
         
            +
            # GNU General Public License for more details.
         
     | 
| 
      
 14 
     | 
    
         
            +
            #
         
     | 
| 
      
 15 
     | 
    
         
            +
            # You should have received a copy of the GNU General Public License
         
     | 
| 
      
 16 
     | 
    
         
            +
            # along with Rest-Client-Wrapper. If not, see <http://www.gnu.org/licenses/>.
         
     | 
| 
      
 17 
     | 
    
         
            +
            #
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            RSpec.shared_context "stub_helper", { shared_context: :metadata } do
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,216 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: rest-client-wrapper
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.0.1
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - University of Adelaide
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-07-04 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: json
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.8'
         
     | 
| 
      
 20 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 21 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 22 
     | 
    
         
            +
                    version: 1.8.3
         
     | 
| 
      
 23 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 24 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 25 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 26 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 29 
     | 
    
         
            +
                    version: '1.8'
         
     | 
| 
      
 30 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 31 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 32 
     | 
    
         
            +
                    version: 1.8.3
         
     | 
| 
      
 33 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 34 
     | 
    
         
            +
              name: oauth2
         
     | 
| 
      
 35 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 36 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 37 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 38 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 39 
     | 
    
         
            +
                    version: '1.2'
         
     | 
| 
      
 40 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 41 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 42 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 43 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 44 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 45 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 46 
     | 
    
         
            +
                    version: '1.2'
         
     | 
| 
      
 47 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 48 
     | 
    
         
            +
              name: rack
         
     | 
| 
      
 49 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 50 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 51 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 52 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 53 
     | 
    
         
            +
                    version: 2.0.5
         
     | 
| 
      
 54 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 55 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 56 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 57 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 58 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 59 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 60 
     | 
    
         
            +
                    version: 2.0.5
         
     | 
| 
      
 61 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 62 
     | 
    
         
            +
              name: rest-client
         
     | 
| 
      
 63 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 64 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 65 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 66 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 67 
     | 
    
         
            +
                    version: 2.0.2
         
     | 
| 
      
 68 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 69 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 70 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 71 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 72 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 73 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 74 
     | 
    
         
            +
                    version: 2.0.2
         
     | 
| 
      
 75 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 76 
     | 
    
         
            +
              name: typhoeus
         
     | 
| 
      
 77 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 78 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 79 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 80 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 81 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 82 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 83 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 84 
     | 
    
         
            +
                    version: 1.0.1
         
     | 
| 
      
 85 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 86 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 87 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 88 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 89 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 90 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 91 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 92 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 93 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 94 
     | 
    
         
            +
                    version: 1.0.1
         
     | 
| 
      
 95 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 96 
     | 
    
         
            +
              name: colorize
         
     | 
| 
      
 97 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 98 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 99 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 100 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 101 
     | 
    
         
            +
                    version: 0.7.0
         
     | 
| 
      
 102 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 103 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 104 
     | 
    
         
            +
                    version: '0.7'
         
     | 
| 
      
 105 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 106 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 107 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 108 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 109 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 110 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 111 
     | 
    
         
            +
                    version: 0.7.0
         
     | 
| 
      
 112 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 113 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 114 
     | 
    
         
            +
                    version: '0.7'
         
     | 
| 
      
 115 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 116 
     | 
    
         
            +
              name: geminabox
         
     | 
| 
      
 117 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 118 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 119 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 120 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 121 
     | 
    
         
            +
                    version: 0.13.0
         
     | 
| 
      
 122 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 123 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 124 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 125 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 126 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 127 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 128 
     | 
    
         
            +
                    version: 0.13.0
         
     | 
| 
      
 129 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 130 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 131 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 132 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 133 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 134 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 135 
     | 
    
         
            +
                    version: 3.4.0
         
     | 
| 
      
 136 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 137 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 138 
     | 
    
         
            +
                    version: '3.4'
         
     | 
| 
      
 139 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 140 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 141 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 142 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 143 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 144 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 145 
     | 
    
         
            +
                    version: 3.4.0
         
     | 
| 
      
 146 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 147 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 148 
     | 
    
         
            +
                    version: '3.4'
         
     | 
| 
      
 149 
     | 
    
         
            +
            description: Generic REST client wrapper
         
     | 
| 
      
 150 
     | 
    
         
            +
            email:
         
     | 
| 
      
 151 
     | 
    
         
            +
            - myuni.admin@adelaide.edu.au
         
     | 
| 
      
 152 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 153 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 154 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 155 
     | 
    
         
            +
            files:
         
     | 
| 
      
 156 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 157 
     | 
    
         
            +
            - lib/rest_client_wrapper.rb
         
     | 
| 
      
 158 
     | 
    
         
            +
            - lib/rest_client_wrapper/authenticators/auth.rb
         
     | 
| 
      
 159 
     | 
    
         
            +
            - lib/rest_client_wrapper/authenticators/basic.rb
         
     | 
| 
      
 160 
     | 
    
         
            +
            - lib/rest_client_wrapper/authenticators/custom.rb
         
     | 
| 
      
 161 
     | 
    
         
            +
            - lib/rest_client_wrapper/authenticators/oauth.rb
         
     | 
| 
      
 162 
     | 
    
         
            +
            - lib/rest_client_wrapper/authenticators/token.rb
         
     | 
| 
      
 163 
     | 
    
         
            +
            - lib/rest_client_wrapper/constants.rb
         
     | 
| 
      
 164 
     | 
    
         
            +
            - lib/rest_client_wrapper/exceptions.rb
         
     | 
| 
      
 165 
     | 
    
         
            +
            - lib/rest_client_wrapper/http.rb
         
     | 
| 
      
 166 
     | 
    
         
            +
            - lib/rest_client_wrapper/paginators/echo.rb
         
     | 
| 
      
 167 
     | 
    
         
            +
            - lib/rest_client_wrapper/paginators/echo_paginator.rb
         
     | 
| 
      
 168 
     | 
    
         
            +
            - lib/rest_client_wrapper/paginators/header_link.rb
         
     | 
| 
      
 169 
     | 
    
         
            +
            - lib/rest_client_wrapper/paginators/header_link_paginator.rb
         
     | 
| 
      
 170 
     | 
    
         
            +
            - lib/rest_client_wrapper/paginators/paginate.rb
         
     | 
| 
      
 171 
     | 
    
         
            +
            - lib/rest_client_wrapper/request.rb
         
     | 
| 
      
 172 
     | 
    
         
            +
            - lib/rest_client_wrapper/response.rb
         
     | 
| 
      
 173 
     | 
    
         
            +
            - lib/rest_client_wrapper/rest_client.rb
         
     | 
| 
      
 174 
     | 
    
         
            +
            - lib/rest_client_wrapper/version.rb
         
     | 
| 
      
 175 
     | 
    
         
            +
            - rest-client-wrapper.gemspec
         
     | 
| 
      
 176 
     | 
    
         
            +
            - spec/authenticators/oauth_spec.rb
         
     | 
| 
      
 177 
     | 
    
         
            +
            - spec/factories/request.rb
         
     | 
| 
      
 178 
     | 
    
         
            +
            - spec/factories/response.rb
         
     | 
| 
      
 179 
     | 
    
         
            +
            - spec/request_spec.rb
         
     | 
| 
      
 180 
     | 
    
         
            +
            - spec/rest_client_spec.rb
         
     | 
| 
      
 181 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 182 
     | 
    
         
            +
            - spec/support/factory_bot.rb
         
     | 
| 
      
 183 
     | 
    
         
            +
            - spec/support/stub_helper.rb
         
     | 
| 
      
 184 
     | 
    
         
            +
            homepage: https://github.com/universityofadelaide/rest-client-wrapper
         
     | 
| 
      
 185 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 186 
     | 
    
         
            +
            - GPL 3.0
         
     | 
| 
      
 187 
     | 
    
         
            +
            metadata:
         
     | 
| 
      
 188 
     | 
    
         
            +
              allowed_push_host: https://rubygems.org
         
     | 
| 
      
 189 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 190 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 191 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 192 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 193 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 194 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 195 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 196 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 197 
     | 
    
         
            +
                  version: 2.4.0
         
     | 
| 
      
 198 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 199 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 200 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 201 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 202 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 203 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 204 
     | 
    
         
            +
            rubygems_version: 3.0.4
         
     | 
| 
      
 205 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 206 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 207 
     | 
    
         
            +
            summary: Rest client wrapper
         
     | 
| 
      
 208 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 209 
     | 
    
         
            +
            - spec/authenticators/oauth_spec.rb
         
     | 
| 
      
 210 
     | 
    
         
            +
            - spec/factories/response.rb
         
     | 
| 
      
 211 
     | 
    
         
            +
            - spec/factories/request.rb
         
     | 
| 
      
 212 
     | 
    
         
            +
            - spec/request_spec.rb
         
     | 
| 
      
 213 
     | 
    
         
            +
            - spec/rest_client_spec.rb
         
     | 
| 
      
 214 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 215 
     | 
    
         
            +
            - spec/support/factory_bot.rb
         
     | 
| 
      
 216 
     | 
    
         
            +
            - spec/support/stub_helper.rb
         
     |