Class: VagrantPlugins::Pushbullet::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Pushbullet::Config
- Defined in:
- lib/vagrant-pushbullet/config.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
-
#token ⇒ Object
API parameters.
Instance Method Summary collapse
- #attributes ⇒ Object
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #is_config_valid ⇒ Object
- #set {|_self| ... } ⇒ Object
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 16 17 |
# File 'lib/vagrant-pushbullet/config.rb', line 11 def initialize super @token = UNSET_VALUE @config_file = UNSET_VALUE end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
9 10 11 |
# File 'lib/vagrant-pushbullet/config.rb', line 9 def @message end |
#token ⇒ Object
API parameters
8 9 10 |
# File 'lib/vagrant-pushbullet/config.rb', line 8 def token @token end |
Instance Method Details
#attributes ⇒ Object
42 43 44 |
# File 'lib/vagrant-pushbullet/config.rb', line 42 def attributes [ @token ] end |
#finalize! ⇒ Object
53 54 55 |
# File 'lib/vagrant-pushbullet/config.rb', line 53 def finalize! @token = nil if @token == UNSET_VALUE end |
#is_config_valid ⇒ Object
46 47 48 49 50 51 |
# File 'lib/vagrant-pushbullet/config.rb', line 46 def is_config_valid attributes.each do |attribute| return true if attribute != UNSET_VALUE end false end |
#set {|_self| ... } ⇒ Object
19 20 21 |
# File 'lib/vagrant-pushbullet/config.rb', line 19 def set yield self if block_given? end |
#validate(machine) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vagrant-pushbullet/config.rb', line 24 def validate(machine) errors = [] @config_file = ::VagrantPlugins::Pushbullet.config_file unless @config_file && @config_file.exist? errors << "Pushbullet configuration file created at: #{@config_file}" errors << "run `pushbullet-config` for assistance on entering required values in that file." errors << "\n --- you will not see this error again ----" ::VagrantPlugins::Pushbullet.write_default_key end require @config_file @token = PushbulletConfig::TOKEN {Pushbullet: errors} end |