Class: GoogleDrive::Config Private
- Inherits:
-
Object
- Object
- GoogleDrive::Config
- Defined in:
- lib/google_drive/config.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- FIELDS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w(client_id client_secret scope refresh_token).freeze
Instance Method Summary collapse
-
#initialize(config_path) ⇒ Config
constructor
private
A new instance of Config.
- #save ⇒ Object private
Constructor Details
#initialize(config_path) ⇒ Config
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Config.
12 13 14 15 16 17 18 19 |
# File 'lib/google_drive/config.rb', line 12 def initialize(config_path) @config_path = config_path if ::File.exist?(config_path) JSON.parse(::File.read(config_path)).each do |key, value| instance_variable_set("@#{key}", value) if FIELDS.include?(key) end end end |
Instance Method Details
#save ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/google_drive/config.rb', line 21 def save ::File.open(@config_path, 'w', 0600) { |f| f.write(to_json) } end |