Sha256: 1060f95abdda33a4917d87139421647fa9382b68b6585bf527c75f0bd9cb2a3b

Contents?: true

Size: 1.01 KB

Versions: 60

Compression:

Stored size: 1.01 KB

Contents

module ForestLiana
  class GoogleAuthorizedUserGetter < UsersGetter
    def initialize(rendering_id, forest_token)
      @forest_token = forest_token
      super('google-authorization', rendering_id)
    end

    def handle_service_response(response)
      if response.is_a?(Net::HTTPOK)
        body = JSON.parse(response.body)
        body['data']['attributes']
      elsif response.is_a?(Net::HTTPNotFound)
        FOREST_LOGGER.error "Cannot retrieve the project you\'re trying " \
          "to unlock. Can you check that you properly copied the Forest " \
          "env_secret in the forest_liana initializer?"
        nil
      elsif response.is_a?(Net::HTTPUnauthorized)
        FOREST_LOGGER.error "Cannot retrieve the user for the project " \
          "you\'re trying to unlock. The google user account seems invalid."
        nil
      else
        FOREST_LOGGER.error "Cannot retrieve the user for the project " \
          "you\'re trying to unlock. An error occured in Forest API."
        nil
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
forest_liana-2.11.13 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.12 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.11 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.10 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.9 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.8 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.7 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.6 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.5 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.4 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.3 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.2 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.1 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.11.0 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.10.5 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.10.4 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.10.3 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.10.2 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.10.1 app/services/forest_liana/google_authorized_user_getter.rb
forest_liana-2.10.0 app/services/forest_liana/google_authorized_user_getter.rb