Skip to content

Latest commit

 

History

History
706 lines (457 loc) · 29.1 KB

CHANGELOG.md

File metadata and controls

706 lines (457 loc) · 29.1 KB

Change log

v1.1.0 (Jan 09, 2024)

Bugfix

Dependabot

  • #965 Bump faraday from 2.7.12 to 2.8.1 (@ryz310)
  • #972 Bump rubocop-performance from 1.19.1 to 1.20.2 (@ryz310)

v1.0.0 (Dec 07, 2023)

Feature

  • #955 Enable Dynamic URL Generation for #pageable_get via Proc Objects (@ryz310)
# Example of using a Proc with pageable_get
pget 'api/example', headers:, query:, paging: ->(response) {
  # Custom logic to generate the next URL
}

Dependabot

v0.27.0 (Nov 13, 2023)

Feature

api_clinet = ExampleApiClient.new(access_token: 'access_token')

# You can retrieve sawyer response with return value
api_clinet.get_users #=> #<Sawyer::Resource>

# You can retrieve sawyer response with block
api_clinet.get_users do |response|
  response #=> #<Sawyer::Response>
  response.headers #=> #<Hash>
  response.data #=> #<Sawyer::Resource>
end

Breaking Change

  • #931 End of support for ruby 2.7 and rails 6.0 (@ryz310)

Dependabot

Misc

v0.26.0 (Jul 04, 2023)

Bugfix

  • #914 Fix error that generating api client failed on Rails 7 (@ryz310)

Dependabot

v0.25.0 (Feb 12, 2023)

Breaking Change

  • #864 Support Ruby 3.2 and drop support for Rails 5.2 (@ryz310)

Rubocop Challenge

  • #809 Style/RedundantConstantBase-20221208233100 (@ryz310)
  • #812 Lint/RedundantCopDisableDirective-20221211233112 (@ryz310)
  • #862 Performance/StringInclude-20230206233100 (@ryz310)

Dependabot

v0.24.0 (Nov 07, 2022)

Feature

  • #792 Support response header error handling (@okumud)

Rubocop Challenge

Dependabot

  • #758 ryz310/dependabot/bundler/rubocop-performance-1.14.3 (@ryz310)
  • #772 Bump pry-byebug from 3.10.0 to 3.10.1 (@ryz310)
  • #773 Bump webmock from 3.17.1 to 3.18.1 (@ryz310)
  • #775 Bump activesupport from 7.0.3.1 to 7.0.4 (@ryz310)
  • #778 Bump rspec_junit_formatter from 0.5.1 to 0.6.0 (@ryz310)
  • #780 Bump faraday from 2.5.2 to 2.6.0 (@ryz310)
  • #791 Bump rspec from 3.11.0 to 3.12.0 (@ryz310)

Misc

v0.23.0 (Jun 08, 2022)

Feature

  • #731 Allow the error class to be initialized with no arguments (@ryz310)

Breaking Change

Rubocop Challenge

  • #698 RSpec/VerifiedDoubleReference-20220419233100 (@ryz310)
  • #700 Style/FetchEnvVar-20220421233101 (@ryz310)
  • #728 Re-generate .rubocop_todo.yml with RuboCop v1.30.1 (@ryz310)

Dependabot

v0.22.0 (Dec 26, 2021)

Feature

Rubocop Challenge

  • #617 RSpec/ExcessiveDocstringSpacing-20210922233114 (@ryz310)
  • #623 Security/IoMethods-20210930233112 (@ryz310)
  • #624 Re-generate .rubocop_todo.yml with RuboCop v1.22.1 (@ryz310)
  • #638 Gemspec/RequireMFA-20211115233105 (@ryz310)

Dependabot

  • #576 Bump bugsnag from 6.21.0 to 6.22.1 (@ryz310)
  • #612 ryz310/dependabot/bundler/faraday-1.8.0 (@ryz310)
  • #625 ryz310/dependabot/bundler/bugsnag-6.24.0 (@ryz310)
  • #635 Bump rubocop-performance from 1.11.5 to 1.12.0 (@ryz310)
  • #636 ryz310/dependabot/bundler/rubocop-rspec-2.6.0 (@ryz310)
  • #639 Bump yard from 0.9.26 to 0.9.27 (@ryz310)
  • #640 Bump bugsnag from 6.24.0 to 6.24.1 (@ryz310)
  • #641 Bump activesupport from 6.1.4.1 to 6.1.4.2 (@ryz310)
  • #644 ryz310/dependabot/bundler/activesupport-6.1.4.4 (@ryz310)

v0.21.0 (Aug 07, 2021)

Feature

Breaking Change

Rubocop Challenge

  • #523 Layout/LineEndStringConcatenationIndentation-20210629233103 (@ryz310)
  • #562 Re-generate .rubocop_todo.yml with RuboCop v1.18.4 (@ryz310)

Misc

v0.20.0 (Mar 07, 2021)

Feature

Rubocop Challenge

  • #414 Style/StringConcatenation-20210106033935 (@ryz310)
  • #416 Style/HashTransformValues-20210106233116 (@ryz310)
  • #433 Lint/SymbolConversion-20210128233108 (@ryz310)
  • #452 Re-generate .rubocop_todo.yml with RuboCop v1.11.0 (@ryz310)

Misc

v0.19.0 (Jan 04, 2021)

Feature

Rubocop Challenge

  • #400 Re-generate .rubocop_todo.yml with RuboCop v1.7.0 (@ryz310)

v0.18.0 (Dec 04, 2020)

Feature

Breaking Change

  • #365 End of support for Ruby 2.4 and Rails 4.2 (@ryz310)

Rubocop Challenge

  • #383 Re-generate .rubocop_todo.yml with RuboCop v1.5.1 (@ryz310)

v0.17.0 (Sep 20, 2020)

Feature

  • #303 Change the duration format to milliseconds (@ryz310)
  • #308 Add testing for api client generators (@ryz310)

Rubocop Challenge

  • #311 Style/GlobalStdStream-20200906233350 (@ryz310)
  • #312 Style/StringConcatenation-20200907233020 (@ryz310)
  • #313 Style/HashTransformValues-20200908233016 (@ryz310)
  • #316 Layout/EmptyLinesAroundAttributeAccessor-20200909233021 (@ryz310)
  • #320 Re-generate .rubocop_todo.yml with RuboCop v0.91.0 (@ryz310)

v0.16.1 (Aug 27, 2020)

Feature

Rubocop Challenge

  • #256 Performance/StartWith-20200523233027 (@ryz310)
  • #268 Lint/RedundantCopDisableDirective-20200622233019 (@ryz310)
  • #289 Re-generate .rubocop_todo.yml with RuboCop v0.89.1 (@ryz310)
  • #293 RSpec/LeadingSubject-20200817233022 (@ryz310)

Misc

v0.16.0 (Mar 29, 2020)

Breaking Change

#225 Raise an exception whenever an error is detected (@ryz310)

Until now, using with or block in error_handling did not automatically raise an exception, but will now always raise an exception when an error is detected. You can specify raising error class with raise option.

Before

error_handling json: { '$.errors.code': 10..19 }, with: :my_error_handling

def my_error_handling
  # Executes this method when an error is detected.
  # No exception is raised. You can raise an error if necessary.
end
error_handling status_code: 500..599 do |_params, logger|
  # Executes this block when an error is detected.
  # No exception is raised. You can raise an error if necessary.
end

After

error_handling json: { '$.errors.code': 10..19 }, with: :my_error_handling

def my_error_handling
  # Executes this method when an error is detected.
  # And then raise `MyApiClient::Error`.
end
error_handling status_code: 500..599 do |params, logger|
  # Executes this block when an error is detected.
  # And then raise `MyApiClient::Error`.
end

#226 Default error handlers (@ryz310)

Until now, you needed define all error_handling or retry_on yourself. But will now some error_handling and retry_on are prepared as default.

You can check default error_handling or retry_on here.

See: https://github.com/ryz310/my_api_client/blob/master/lib/my_api_client/default_error_handlers.rb

Misc

v0.15.0 (Mar 21, 2020)

Feature

  • #220 Pageable HTTP request (@ryz310)

    • Add #pageable_get method (alias: #pget)

    • For example:

      • API client definition

        class MyPaginationApiClient < ApplicationApiClient
          endpoint 'https://example.com/v1'
        
          # GET pagination?page=1
          def pagination
            pageable_get 'pagination', paging: '$.links.next', headers: headers, query: { page: 1 }
          end
        
          private
        
          def headers
            { 'Content-Type': 'application/json;charset=UTF-8' }
          end
        end
      • The pagination API response

        {
          "links": {
            "next": "https://example.com/pagination?page=3",
            "previous": "https://example.com/pagination?page=1"
          },
          "page": 2
        }
      • Usage

        api_clinet = MyPaginationApiClient.new
        api_clinet.pagination.each do |response|
          # Do something.
        end
        
        p = api_clinet.pagination
        p.next # => 1st page result
        p.next # => 2nd page result
        p.next # => 3rd page result
  • #223 Use Enumerator::Lazy instead of Enumerator (@ryz310)

v0.14.0 (Mar 14, 2020)

Feature

  • #211 Integration testing using the jets framework (@ryz310)
  • #213 Add status API to integration testing (@ryz310)
  • #214 Add error API to integration testing (@ryz310)
  • #215 Update the REST API to enhance integration testing (@ryz310)

Refactoring

Breaking Change

logging

before

I, [2020-02-02T15:26:53.788092 #93220]  INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts`: "Start"
I, [2020-02-02T15:26:55.760452 #93220]  INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts`: "Duration 1.97186 sec"
I, [2020-02-02T15:26:55.760739 #93220]  INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts`: "Success (200)"

after

Shows URL with query strings.

I, [2020-02-02T15:20:47.471040 #90870]  INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts?page=1&per_page=100&q=user%3Aryosuke_sato+category%3Aunsorted`: "Start"
I, [2020-02-02T15:20:49.516099 #90870]  INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts?page=1&per_page=100&q=user%3Aryosuke_sato+category%3Aunsorted`: "Duration 2.034907 sec"
I, [2020-02-02T15:20:49.516391 #90870]  INFO -- : API request `GET https://api.esa.io/v1/teams/feedforce/posts?page=1&per_page=100&q=user%3Aryosuke_sato+category%3Aunsorted`: "Success (200)"

MyApiClient::Params::Request

before

request_params.metadata # =>
# {
#   line: 'GET path/to/resource',
#   headers: { 'Content-Type': 'application/json; charset=utf-8' },
#   query: { key: 'value' }
# }

after

The #metadata does not include query key and then includes full URL into line value.

request_params.metadata # =>
# {
#   line: 'GET https://example.com/path/to/resource?key=value',
#   headers: { 'Content-Type': 'application/json; charset=utf-8' }
# }

Rubocop Challenge

  • #205 Re-generate .rubocop_todo.yml with RuboCop v0.80.0 (@ryz310)
  • #210 Re-generate .rubocop_todo.yml with RuboCop v0.80.1 (@ryz310)

v0.13.0 (Jan 21, 2020)

Feature

v0.12.0 (Jan 19, 2020)

Feature

  • #173 Avoid sleep on testing (@ryz310)
  • #175 Verify arguments on error handling definition (@ryz310)
  • #176 Provides a syntax sugar of retry_on on error_handling (@ryz310)

Bugfix

v0.11.0 (Jan 16, 2020)

Feature

Rubocop Challenge

  • #158 Re-generate .rubocop_todo.yml with RuboCop v0.78.0 (@ryz310)
  • #168 Re-generate .rubocop_todo.yml with RuboCop v0.79.0 (@ryz310)

v0.10.3 (Dec 05, 2019)

Bugfix

Rubocop Challenge

  • #136 Re-generate .rubocop_todo.yml with RuboCop v0.76.0 (@ryz310)
  • #148 Re-generate .rubocop_todo.yml with RuboCop v0.77.0 (@ryz310)

0.10.2 (Oct 23, 2019)

Bugfix

  • Ignore error handling when using request to matcher (#130)
  • Fix be_handled_as_an_error description (#131)

0.10.1 (Oct 23, 2019)

Feature

  • Support retry_on testing at shoulda matcher (#127)

0.10.0 (Oct 23, 2019)

Feature

  • Shoulda-matchers for my_api_client (#124)

Misc

  • Modify request specifications (#120)
  • Re-generate .rubocop_todo.yml with RuboCop v0.75.1 (#121)

0.9.2 (Oct 8, 2019)

Bugfix

  • Fix endpoint parsing when including port number (#117)
    • Fixes: Can't request to URL which includes port numbert (#116)

Misc

  • Re-generate .rubocop_todo.yml with RuboCop v0.74.0 (#100)

  • Re-generate .rubocop_todo.yml with RuboCop v0.75.0 (#112)

  • Support Rails 6.0 (#101)

  • deprecated/my_api_client_stub (#102)

0.9.1 (July 25, 2019)

Bugfix

  • Fix forbid nil option (#97) Breaking Changes

0.9.0 (July 25, 2019)

New Features

  • Forbid nil response (#93)

Misc

  • RSpec/DescribedClass-20190723233015 (#92)

0.8.0 (July 23, 2019)

New Features

  • Allow method calling on error handling (#89)

Breaking Changes

  • Require sawyer gem v0.8.2 over (#88)

0.7.0 (July 17, 2019)

Features

  • Add request duration to metadata (#80)
  • Support boolean on error handling (#81)

Breaking Changes

  • Modify the generator to be simple (#82)

Misc

  • Re-generate .rubocop_todo.yml with RuboCop v0.73.0 (#79)
  • Introduce gem comet (#85)

0.6.2 (July 03, 2019)

Bug fixes

  • Fix logger setter on the template (#76)
    • Fixes: The logger does not work... (#54)

0.6.1 (July 03, 2019)

Misc

  • Bump yard from 0.9.19 to 0.9.20 (#72)
    • Fix a security risk

0.6.0 (June 25, 2019)

New Features

  • New stubbing helper (#65)
stub_api_client_all(
  ExampleApiClient,
  get_user: { response: { id: 1 } },               # Returns an arbitrary response.
  post_users: { id: 1 },                           # You can ommit `response` keyword.
  patch_user: ->(params) { { id: params[:id] } },  # Returns calculated result as response.
  delete_user: { raise: MyApiClient::ClientError } # Raises an arbitrary error.
)
response = ExampleApiClient.new.get_user(id: 123)
response.id # => 1
api_client = stub_api_client(
  ExampleApiClient,
  get_user: { response: { id: 1 } },               # Returns an arbitrary response.
  post_users: { id: 1 },                           # You can ommit `response` keyword.
  patch_user: ->(params) { { id: params[:id] } },  # Returns calculated result as response.
  delete_user: { raise: MyApiClient::ClientError } # Raises an arbitrary error.
)
response = api_client.get_user(id: 123)
response.id # => 1

0.5.3 (June 23, 2019)

Bug Fixes

  • Initialize sawyer agent before logger initialization (#60)
    • Fixes: The URL included in the logger is incomplete (#53)
  • Fix parsing error if given text/html response (#61)

0.5.2 (June 23, 2019)

Bug Fixes

  • Fix the result of the retry (#57)
    • Issue: Return values are nil after retrying (#56)

Misc

  • Improvement test coverage (#55)

0.5.1 (June 19, 2019)

Bug Fixes

  • Fix unsupported data for the Bugsnag breadcrumbs (#50)

0.5.0 (June 16, 2019)

New Features

  • Support bugsnag breadcrumb (#41)

Misc

  • Use CircleCI Orbs (#43)

0.4.0 (June 03, 2019)

Feature

  • Improvement for endpoint (#35)

Bug Fix

  • Add requirements for $ bin/console (#31)

Misc

  • Update RuboCop v0.70.0 -> v0.71.0 (#34)

0.3.0 (May 29, 2019)

New Features

  • Provide test helper for RSpec (#28)

0.2.0 (May 29, 2019)

New Features

  • Support Bugsnag metadata (#22)

Misc

  • Improve test coverage (#24)
  • Fix problem on the release job (#25)

0.1.4 (May 28, 2019)

Bugfix

  • Support activesupport before v5.2.0 (#17)

0.1.3 (May 27, 2019)

  • Fix wrong variable name (#13)

0.1.2 (May 27, 2019)

  • Fix wrong method name (#10)

0.1.1 (May 27, 2019)

  • Fix typo (#6)

0.1.0 (May 27, 2019)

  • The first release 🎉