Sha256: 94f0b26412012a6ae7e823c4db118838e3e392505323b66bd5785fa3528e3998

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

module CandyCheck
  module CLI
    module Commands
      # Command to verify an PlayStore purchase
      class PlayStore < Base
        # Prepare a verification run from the terminal
        # @param package_name [String]
        # @param product_id [String]
        # @param token [String]
        # @param options [Hash]
        # @option options [String] :json_key_file to use for API access
        def initialize(package_name, product_id, token, options)
          @package = package_name
          @product_id = product_id
          @token = token
          super(options)
        end

        # Print the result of the verification to the terminal
        def run
          verifier = CandyCheck::PlayStore::Verifier.new(authorization: authorization)
          result = verifier.verify_product_purchase(
            package_name: @package,
            product_id: @product_id,
            token: @token,
          )
          out.print "#{result.class}:"
          out.pretty result
        end

        private

        def authorization
          CandyCheck::PlayStore.authorization(options["json_key_file"])
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
candy_check-0.6.0 lib/candy_check/cli/commands/play_store.rb
candy_check-0.5.0 lib/candy_check/cli/commands/play_store.rb
candy_check-0.4.0 lib/candy_check/cli/commands/play_store.rb
candy_check-0.3.0 lib/candy_check/cli/commands/play_store.rb
candy_check-0.2.1 lib/candy_check/cli/commands/play_store.rb
candy_check-0.2.0 lib/candy_check/cli/commands/play_store.rb