Sha256: e2869694afd68639c963bbb6f3e1b71585ff55c90c2a197547a125b92b4dea72

Contents?: true

Size: 814 Bytes

Versions: 4

Compression:

Stored size: 814 Bytes

Contents

module CandyCheck
  module AppStore
    # Verifies a latest_receipt_info block against a verification server.
    # The call return either an {ReceiptCollection} or a {VerificationFailure}
    class SubscriptionVerification < CandyCheck::AppStore::Verification
      # Performs the verification against the remote server
      # @return [ReceiptCollection] if successful
      # @return [VerificationFailure] otherwise
      def call!
        verify!
        if valid?
          ReceiptCollection.new(@response['latest_receipt_info'])
        else
          VerificationFailure.fetch(@response['status'])
        end
      end

      private

      def valid?
        status_is_ok = @response['status'] == STATUS_OK
        @response && status_is_ok && @response['latest_receipt_info']
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
candy_check-0.2.0 lib/candy_check/app_store/subscription_verification.rb
candy_check-0.1.2 lib/candy_check/app_store/subscription_verification.rb
candy_check-0.1.1 lib/candy_check/app_store/subscription_verification.rb
candy_check-0.1.0.pre lib/candy_check/app_store/subscription_verification.rb