Class: InstagramConnect::Doctor

Inherits:
Object
  • Object
show all
Defined in:
lib/instagram_connect/doctor.rb

Overview

Preflight configuration checks, surfaced by the instagram_connect doctor CLI. Returns a list of { label:, ok: } so the CLI (or a host) can render it.

Class Method Summary collapse

Class Method Details

.check(label, ok) ⇒ Object



14
15
16
# File 'lib/instagram_connect/doctor.rb', line 14

def self.check(label, ok)
  { label: label, ok: ok }
end

.present?(value) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/instagram_connect/doctor.rb', line 18

def self.present?(value)
  !value.to_s.empty?
end

.run(config: InstagramConnect.configuration) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/instagram_connect/doctor.rb', line 5

def self.run(config: InstagramConnect.configuration)
  [
    check("auth_path is valid", Configuration::AUTH_PATHS.include?(config.auth_path)),
    check("app_id is set", present?(config.app_id)),
    check("app_secret is set", present?(config.app_secret)),
    check("verify_token is set", present?(config.verify_token))
  ]
end