Class: CandyCheck::CLI::Commands::PlayStore

Inherits:
Base
  • Object
show all
Defined in:
lib/candy_check/cli/commands/play_store.rb

Overview

Command to verify an PlayStore purchase

Instance Method Summary collapse

Methods inherited from Base

run

Constructor Details

#initialize(package_name, product_id, token, options) ⇒ PlayStore

Prepare a verification run from the terminal

Parameters:

  • package_name (String)
  • product_id (String)
  • token (String)
  • options (Hash)

Options Hash (options):

  • :json_key_file (String)

    to use for API access



12
13
14
15
16
17
# File 'lib/candy_check/cli/commands/play_store.rb', line 12

def initialize(package_name, product_id, token, options)
  @package = package_name
  @product_id = product_id
  @token = token
  super(options)
end

Instance Method Details

#runObject

Print the result of the verification to the terminal



20
21
22
23
24
25
26
27
28
29
# File 'lib/candy_check/cli/commands/play_store.rb', line 20

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