Sha256: 67cbb2b1bfa55283cfeacee58ee769e82246a7ac0a8f4827649321a47258fd85

Contents?: true

Size: 522 Bytes

Versions: 2

Compression:

Stored size: 522 Bytes

Contents

# frozen_string_literal: true

require_relative 'api_wrapper'

module Stash
  module Rewards
    class GetReward < ApiWrapper
      def call(campaign_id:, reward_id:)
        api_response = api_wrapper.get("campaigns/#{campaign_id}/rewards/#{reward_id}")
        response = Stash::Rewards::Response.new(api_response)
        raise Stash::Rewards::Error, response.error_message if response.error?

        response
      rescue Faraday::Error => e
        raise Stash::Rewards::Error, e.message
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stash-rewards-0.0.4 lib/stash/rewards/get_reward.rb
stash-rewards-0.0.3 lib/stash/rewards/get_reward.rb