gds-api-adapters 18.8.0 → 18.9.0
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/gds_api/support_api.rb +9 -0
- data/lib/gds_api/test_helpers/support_api.rb +20 -0
- data/lib/gds_api/version.rb +1 -1
- data/test/support_api_test.rb +33 -0
- 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: e0e568b7a3e0e220c2e8afb82658ba990a38fc75
         | 
| 4 | 
            +
              data.tar.gz: 7a5f7b7afc65f730ee352df1b61265e4735a065f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 5f1d1e421d9da081394735ed6dd7101d0812acb22a920b6b98631cc420ba65865968435980da59357c12cb6e42c7d1f6b39777bbaa796e9823af8d8b88335044
         | 
| 7 | 
            +
              data.tar.gz: 9a6b7a1d95aa39a07a1be6a4833a7d98d91e6ec7885d661354801ee4691fe3a2a4700372fc8bc5009ad01359fe8b0c386e0be68680a2cf23df6befb136e4fb1a
         | 
    
        data/lib/gds_api/support_api.rb
    CHANGED
    
    | @@ -22,4 +22,13 @@ class GdsApi::SupportApi < GdsApi::Base | |
| 22 22 | 
             
                uri = "#{endpoint}/anonymous-feedback" + query_string(options)
         | 
| 23 23 | 
             
                get_json!(uri)
         | 
| 24 24 | 
             
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              def organisation_summary(organisation_slug, options = {})
         | 
| 27 | 
            +
                uri = "#{endpoint}/anonymous-feedback/organisations/#{organisation_slug}" + query_string(options)
         | 
| 28 | 
            +
                get_json!(uri)
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
              def organisations_list
         | 
| 32 | 
            +
                get_json!("#{endpoint}/anonymous-feedback/organisations")
         | 
| 33 | 
            +
              end
         | 
| 25 34 | 
             
            end
         | 
| @@ -41,6 +41,26 @@ module GdsApi | |
| 41 41 | 
             
                      with(query: params).
         | 
| 42 42 | 
             
                      to_return(status: 200, body: response_body.to_json)
         | 
| 43 43 | 
             
                  end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                  def stub_anonymous_feedback_organisation_summary(slug, ordering = nil, response_body = {})
         | 
| 46 | 
            +
                    uri = "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/organisations/#{slug}"
         | 
| 47 | 
            +
                    uri << "?ordering=#{ordering}" if ordering
         | 
| 48 | 
            +
                    stub_http_request(:get, uri).
         | 
| 49 | 
            +
                      to_return(status: 200, body: response_body.to_json)
         | 
| 50 | 
            +
                  end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                  def stub_anonymous_feedback_organisations_list(response_body = nil)
         | 
| 53 | 
            +
                    response_body ||= [{
         | 
| 54 | 
            +
                      slug: "cabinet-office",
         | 
| 55 | 
            +
                      web_url: "https://www.gov.uk/government/organisations/cabinet-office",
         | 
| 56 | 
            +
                      title: "Cabinet Office",
         | 
| 57 | 
            +
                      acronym: "CO",
         | 
| 58 | 
            +
                      govuk_status: "live"
         | 
| 59 | 
            +
                    }]
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                    stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/organisations").
         | 
| 62 | 
            +
                      to_return(status: 200, body: response_body)
         | 
| 63 | 
            +
                  end
         | 
| 44 64 | 
             
                end
         | 
| 45 65 | 
             
              end
         | 
| 46 66 | 
             
            end
         | 
    
        data/lib/gds_api/version.rb
    CHANGED
    
    
    
        data/test/support_api_test.rb
    CHANGED
    
    | @@ -79,4 +79,37 @@ describe GdsApi::SupportApi do | |
| 79 79 | 
             
                  assert_requested(stub_get)
         | 
| 80 80 | 
             
                end
         | 
| 81 81 | 
             
              end
         | 
| 82 | 
            +
             | 
| 83 | 
            +
              describe "GET /anonymous-feedback/organisations/:organisation_slug" do
         | 
| 84 | 
            +
                it "fetches organisation summary" do
         | 
| 85 | 
            +
                  slug = "hm-revenue-customs"
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                  stub_get = stub_anonymous_feedback_organisation_summary(slug)
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                  @api.organisation_summary(slug)
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                  assert_requested(stub_get)
         | 
| 92 | 
            +
                end
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                it "accepts an ordering parameter" do
         | 
| 95 | 
            +
                  slug = "hm-revenue-customs"
         | 
| 96 | 
            +
                  ordering = "last_30_days"
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                  stub_get = stub_anonymous_feedback_organisation_summary(slug, ordering)
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                  @api.organisation_summary(slug, ordering: ordering)
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                  assert_requested(stub_get)
         | 
| 103 | 
            +
                end
         | 
| 104 | 
            +
              end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
              describe "GET /anonymous-feedback/organisations" do
         | 
| 107 | 
            +
                it "fetches a list of organisations" do
         | 
| 108 | 
            +
                  stub_get = stub_anonymous_feedback_organisations_list
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                  @api.organisations_list
         | 
| 111 | 
            +
             | 
| 112 | 
            +
                  assert_requested(stub_get)
         | 
| 113 | 
            +
                end
         | 
| 114 | 
            +
              end
         | 
| 82 115 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: gds-api-adapters
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 18. | 
| 4 | 
            +
              version: 18.9.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Stewart
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-05- | 
| 11 | 
            +
            date: 2015-05-22 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: plek
         |