Class: BlueskyClient

Inherits:
Object
  • Object
show all
Includes:
Minisky::Requests
Defined in:
app/bluesky_client.rb

Constant Summary collapse

CONFIG_FILE =
File.expand_path(File.join(__dir__, '..', 'config', 'bluesky.yml'))

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBlueskyClient

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

#configObject (readonly)

Returns the value of attribute config.



9
10
11
# File 'app/bluesky_client.rb', line 9

def config
  @config
end

Instance Method Details

#hostObject



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_configObject



24
25
26
# File 'app/bluesky_client.rb', line 24

def save_config
  File.write(CONFIG_FILE, YAML.dump(@config))
end