Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

Commit ef47de0

Browse files
sabatzph
authored andcommitted
fix buff executable, and allow post method to use options hash
1 parent bf74d37 commit ef47de0

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

bin/buff

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,25 @@ require 'buff'
77
begin
88
require 'yaml'
99

10+
rc_file_path = File.expand_path('~/.bufferapprc')
11+
raise Errno::ENOENT unless File.exists?(rc_file_path)
12+
1013
options = YAML.load_file(File.expand_path('~/.bufferapprc'))
1114
if options.class == String
12-
options['access_token'], options['profile_index'] = options.split
15+
options_str = options.dup
16+
options = Hash.new
17+
options['access_token'], options['profile_index'] = options_str.split
1318
options['verion'] = '0.0.0'
1419
end
20+
rescue Errno::ENOENT
21+
puts "You're missing the ~/.bufferapprc file. See the README for info."
22+
exit 1
1523
rescue
1624
puts "Please upgrade from older config file structure" if ENV['BUFF_DEBUG']
1725
end
1826

1927
client = Buff::Client.new(options['access_token'])
2028
id = client.profiles[options['profile_index'].to_i].id
2129

22-
response = client.create_update(body: {text: ARGV.join(" "), profile_ids: [ id ] } )
30+
response = client.create_update(body: {text: ARGV.join(" "), profile_ids: [ id ] })
2331
puts response if ENV['BUFF_DEBUG']

lib/buff/core.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def get(path, options = {})
2929

3030
def post(path, options = {})
3131
params = merge_auth_token_and_query(options)
32+
params.merge!(options)
3233
response = @connection.post do |req|
3334
req.url path.remove_leading_slash
3435
req.headers['Content-Type'] = "application/x-www-form-urlencoded"

0 commit comments

Comments
 (0)