Sha256: 40554919e7a538db55ea5bf1ff9561f278971587e790bc19238346e140625ccb

Contents?: true

Size: 866 Bytes

Versions: 22

Compression:

Stored size: 866 Bytes

Contents

module ForestLiana
  class AllowedUsersGetter < UsersGetter
    def initialize(rendering_id)
      super('allowed-users', rendering_id)
    end

    def handle_service_response(response)
      if response.is_a?(Net::HTTPOK)
        body = JSON.parse(response.body)
        ForestLiana.allowed_users = body['data'].map do |d|
          user = d['attributes']
          user['id'] = d['id']

          user
        end
      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?"
      else
        FOREST_LOGGER.error "Cannot retrieve any users for the project " \
          "you\'re trying to unlock. An error occured in Forest API."
        []
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
forest_liana-2.5.0 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.4.9 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.4.8 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.4.7 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.4.6 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.4.5 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.4.4 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.4.3 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.4.2 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.4.1 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.4.0 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.3.5 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.3.4 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.3.3 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.3.2 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.3.1 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.3.0 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.2.2 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.2.1 app/services/forest_liana/allowed_users_getter.rb
forest_liana-2.2.0 app/services/forest_liana/allowed_users_getter.rb