api_struct icon indicating copy to clipboard operation
api_struct copied to clipboard

New maintainable fork

Open kraft001 opened this issue 2 years ago • 1 comments

Hi, RubyGarage team!

Many thanks for the amazing gem!

However, it hasn't been updated for quite a long time, so we had to fork and upgrade it to make compatible with new ruby versions: https://github.com/uploadcare/uploadcare-api_struct https://rubygems.org/gems/uploadcare-api_struct

Please, let me know if you decide to revive this gem and I'll prepare a PR to copy changes from the fork.

Thanks!

kraft001 avatar Mar 20 '23 16:03 kraft001

Thanks for this @kraft001. I have switched mine over to your fork as I was running ruby 3.2.1 and getting an error something to do with dry-monads Transform / Transformer ... (should have copied it down) or something to that effect.

Once I forked... I had the error uninitialized constant ApiStruct (NameError) thrown which was resolved by simply adding require 'api_struct' to the top of my initializer.

Hopefully this helps someone else so thought I should share the experience.

/config/initializers/api_struct.rb

require 'api_struct'

ApiStruct::Settings.configure do |config|
  config.endpoints = {
    api: {
      root: 'https://api.service.com/external/v1',
      headers: {
        'content-type': 'application/json',
        'Authorization': "Bearer #{ Rails.application.credentials.gospotcheck_api_token }"
      }
    }
  }
end

jaykilleen avatar Mar 30 '23 00:03 jaykilleen