Class: BlueskyClient
- Inherits:
-
Object
- Object
- BlueskyClient
- Includes:
- Minisky::Requests
- Defined in:
- app/bluesky_client.rb
Constant Summary collapse
- CONFIG_FILE =
File.(File.join(__dir__, '..', 'config', 'bluesky.yml'))
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #host ⇒ Object
- #host=(h) ⇒ Object
-
#initialize ⇒ BlueskyClient
constructor
A new instance of BlueskyClient.
- #save_config ⇒ Object
Constructor Details
#initialize ⇒ BlueskyClient
Returns a new instance of BlueskyClient.
11 12 13 14 |
# File 'app/bluesky_client.rb', line 11 def initialize @config = File.exist?(CONFIG_FILE) ? YAML.load(File.read(CONFIG_FILE)) : {} Dir.mkdir('config') unless Dir.exist?('config') end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'app/bluesky_client.rb', line 9 def config @config end |
Instance Method Details
#host ⇒ Object
16 17 18 |
# File 'app/bluesky_client.rb', line 16 def host @config['host'] end |
#host=(h) ⇒ Object
20 21 22 |
# File 'app/bluesky_client.rb', line 20 def host=(h) @config['host'] = h end |
#save_config ⇒ Object
24 25 26 |
# File 'app/bluesky_client.rb', line 24 def save_config File.write(CONFIG_FILE, YAML.dump(@config)) end |