Class: NeverBounce::CLI::Script::POEConfirm

Inherits:
RequestMaker show all
Defined in:
lib/never_bounce/cli/script/poe_confirm.rb

Constant Summary

Constants inherited from RequestMaker

RequestMaker::SHARED_ENVARS

Instance Attribute Summary collapse

Attributes inherited from RequestMaker

#api_key, #api_url, #request_curl, #response, #server_raw, #session, #user_config

Attributes inherited from Meaningful

#banner_text, #envar_text, #help_text, #options_text

Attributes inherited from Base

#argv, #env, #stderr, #stdout

Instance Method Summary collapse

Methods inherited from RequestMaker

#get_table_value, #inil, #print_curl_request, #print_error_response, #print_server_raw, #slim_main1

Methods inherited from Meaningful

#call_slim_main, error_klasses, format_envar_examples, #handle_help_and_options, #help?, #main, #option_parser, #options

Methods inherited from Base

#env_falsey?, #env_truthy?, env_value_truthy?, #main, #system, #verbose?

Instance Attribute Details

#confirmation_tokenObject



24
25
26
# File 'lib/never_bounce/cli/script/poe_confirm.rb', line 24

def confirmation_token
  @confirmation_token ||= env[k = "CONFIRMATION_TOKEN"] or raise UsageError, "Confirmation Token was not given, use `#{k}=`"
end

#emailObject



16
17
18
# File 'lib/never_bounce/cli/script/poe_confirm.rb', line 16

def email
  @email ||= env[k = "EMAIL"] or raise UsageError, "E-mail address not given, use `#{k}=`"
end

#manifestManifest

Returns:



49
50
51
52
53
54
55
# File 'lib/never_bounce/cli/script/poe_confirm.rb', line 49

def manifest
  @manifest ||= Manifest.new(
    name: "nb-poe-confirm",
    function: "Verify a verification performed on the frontend with the Javascript Wdiget",
    cmdline: "[options] [VAR1=value] [VAR2=value] ...",
  )
end

#requestObject

An API::Request::POEConfirm.

Returns:

  • (Object)


35
36
37
38
39
40
41
42
43
# File 'lib/never_bounce/cli/script/poe_confirm.rb', line 35

def request
  @request ||= API::Request::POEConfirm.new({
    api_key: api_key,
    email: email,
    transaction_id: transaction_id,
    confirmation_token: confirmation_token,
    result: result,
  })
end

#resultObject



28
29
30
# File 'lib/never_bounce/cli/script/poe_confirm.rb', line 28

def result
  @result ||= env[k = "RESULT"] or raise UsageError, "Result was not given, use `#{k}=`"
end

#transaction_idObject



20
21
22
# File 'lib/never_bounce/cli/script/poe_confirm.rb', line 20

def transaction_id
  @transaction_id ||= env[k = "TRANSACTION_ID"] or raise UsageError, "Transaction ID was not given, use `#{k}=`"
end

Instance Method Details

#slim_mainInteger

Returns:

  • (Integer)


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/never_bounce/cli/script/poe_confirm.rb', line 60

def slim_main
  "Response".tap do |label|
    headings = [
      ["TokenConfirmed", :token_confirmed],

      ["ExecTime", :execution_time, :right],
    ]

    table = Table.new(
      headings: headings.map { |ar| ar[0] },
      rows: [headings.map { |ar| get_table_value(response, ar) }],
    ).align!(headings)

    stdout.puts "\n#{label}:"
    stdout.puts table
  end

  0
end