buff 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3add86636c4568dac2c94eb6fd1fa399fbd87c4
4
- data.tar.gz: 406043f768863c9cebec98b145b8a9f452d44d51
3
+ metadata.gz: 55d07c19c91104e3a715a9a1e59e6c34e66aff7d
4
+ data.tar.gz: 754e031a6135e86e9be58da6f061995a39f6ff6e
5
5
  SHA512:
6
- metadata.gz: 2ce8e4a47720cbed1cf45a3902065392152f7a21978d8fdcd159c8ec5a35fef736804e563ea7e44b3da2eb51dc99c9539013bebc794b97d41e0d8578041fa80b
7
- data.tar.gz: 5594eb134afac30bbb71e071a50b596dab5a28e4ba18a9b911af8ba3a94a1ab45319370142fe7a9dd519d4c90f533a4c4d28ba16d59550df038fda83f7c49431
6
+ metadata.gz: 9e2bbc9ae2794b4d54afebb526d16f10e1607019ee99e51c09fdb355af5731824939bd0f1349737893d8dd372bfb312daf30294037f2cc8901e1402c017ca15d
7
+ data.tar.gz: 4ebb1ec871e0fb8da7fc8ecb0ffb5d54fbe6ba4402c652d53a73257b7861bde371d84fe1b18b88a9f9d5c37e4aea1120fb0c594fdbc2d616eec09cb0dda8d2f5
@@ -1,21 +1,23 @@
1
- SUPER_SECRET_AUTH_TOKEN
2
- 0
1
+ ---
2
+ access_token: ASDFASDFASDF
3
+ profile_index: 0
4
+ version: 0.0.1
3
5
 
4
6
  # How to Get Started:
5
7
  # Create a Developer API Token here: http://bufferapp.com/developers/apps/create.
6
8
  # Fill in Stuff. Your answers don't matter much for the purpose of this rudimentary setup.
7
9
  # Submit that form and wait a short period (~2 min )
8
10
  # Visit: http://bufferapp.com/developers/apps
9
- # Gather Access Token and place it on line 1 of this file.
11
+ # Gather Access Token and place it after the word "access_token"
10
12
  # Copy this file to the root of your user's home folder:
13
+ # Set "profile_index" to 0 if you only have one account to post to. Otherwise it's more complicated ;). Find me on Twitter and I can explain (@_ZPH).
11
14
  # - ~/.bufferapprc
12
- # Set Line 2 to 0 if you only have one account to post to. Otherwise it's more complicated ;). Find me on Twitter and I can explain (@_ZPH).
13
15
 
14
16
  # Structure:
15
- # Line 1: Access Token
16
- # Line 2: Buffer Account number, ie posting to first account in list, use 0 (ie zero)
17
+ # access_token: Access Token
18
+ # profile_index: Buffer Account number, ie posting to first account in list, use 0 (ie zero)
17
19
  #
18
- #TODO: convert to yaml and improve instructions
20
+ #TODO: improve instructions
19
21
  # remove need for user to create their own App on bufferapp.com
20
22
  # Future versions will integrate with Buffer-OAuth system.
21
23
 
data/README.md CHANGED
@@ -37,34 +37,29 @@ Or install RubyGems version, which will receive more attention to stability:
37
37
 
38
38
 
39
39
  ```
40
- ACCESS_TOKEN
41
- PROFILE_INDEX (default of 0)
40
+ ---
41
+ ACCESS_TOKEN: (BufferApp OAuth Access Token)
42
+ PROFILE_INDEX: (default of 0)
43
+ VERSION: (Do not alter)
42
44
 
43
- # Structure:
44
- # Access Token: line 1
45
- # Profile number, counting from zero
46
45
  ```
47
46
 
48
47
  ## Access Token Instructions
49
48
 
50
- How to Get Started:
49
+ # How to Get Started:
51
50
  ====
52
- * Create a Developer API Token here: http://bufferapp.com/developers/apps/create.
53
- * Fill in Stuff. Your answers don't matter much for the purpose of this rudimentary setup.
54
- * Submit that form and wait a short period (~2 min )
55
- * Visit: http://bufferapp.com/developers/apps
56
- * Gather Access Token and place it on line 1 of this file.
57
- * Copy this file to the root of your user's home folder:
58
- - ~/.bufferapprc
51
+ # Create a Developer API Token here: http://bufferapp.com/developers/apps/create.
52
+ # Fill in Stuff. Your answers don't matter much for the purpose of this rudimentary setup.
53
+ # Submit that form and wait a short period (~2 min )
54
+ # Visit: http://bufferapp.com/developers/apps
55
+ # Gather Access Token and place it after the word "access_token"
56
+ # Copy this file to the root of your user's home folder:
59
57
  * Set Line 2 to 0 if you only have one account to post to. Otherwise it's more complicated ;). Find me on Twitter and I can explain [@_ZPH](https://twitter.com/_ZPH).
58
+ # - ~/.bufferapprc
60
59
 
61
- Structure:
62
- Line 1: Access Token
63
- Line 2: Buffer Account number, ie posting to first account in list, use 0 (ie zero)
64
-
65
- TODO: convert to yaml and improve instructions
66
- remove need for user to create their own App on bufferapp.com
67
- Future versions will integrate with Buffer-OAuth system.
60
+ #TODO: improve instructions
61
+ # remove need for user to create their own App on bufferapp.com
62
+ # Future versions will integrate with Buffer-OAuth system.
68
63
 
69
64
  ## API Coverage
70
65
 
data/bin/buff CHANGED
@@ -4,10 +4,20 @@ $LOAD_PATH.unshift(File.dirname(__FILE__), '..', 'lib')
4
4
 
5
5
  require 'buff'
6
6
 
7
- access_token, profile_id = File.open(File.expand_path '~/.bufferapprc').readlines.map(&:chomp)
7
+ begin
8
+ require 'yaml'
8
9
 
9
- client = Buff::Client.new(access_token)
10
- id = client.profiles[profile_id.to_i].id
10
+ options = YAML.load_file(File.expand_path('~/.bufferapprc'))
11
+ if options.class == String
12
+ options['access_token'], options['profile_index'] = options.split
13
+ options['verion'] = '0.0.0'
14
+ end
15
+ rescue
16
+ puts "Please upgrade from older config file structure" if ENV['BUFF_DEBUG']
17
+ end
18
+
19
+ client = Buff::Client.new(options['access_token'])
20
+ id = client.profiles[options['profile_index'].to_i].id
11
21
 
12
22
  response = client.create_update(body: {text: ARGV.join(" "), profile_ids: [ id ] } )
13
23
  puts response if ENV['BUFF_DEBUG']
@@ -3,12 +3,12 @@ require 'pathname'
3
3
  module Buff
4
4
  begin
5
5
  #TODO: change from #expand_path to Pathname if appropriate
6
- if File.exists?(File.expand_path("~/.bufferapprc"))
7
- ACCESS_TOKEN = File.open(File.expand_path("~/.bufferapprc")).
8
- readlines[0].chomp
9
- end
10
- rescue => x
11
- raise x, "Bufferapprc appears to be malformed"
6
+ # if File.exists?(File.expand_path("~/.bufferapprc"))
7
+ # ACCESS_TOKEN = File.open(File.expand_path("~/.bufferapprc")).
8
+ # readlines[0].chomp
9
+ # end
10
+ # rescue => x
11
+ # raise x, "Bufferapprc appears to be malformed"
12
12
  end
13
13
 
14
14
  class Client
@@ -1,3 +1,3 @@
1
1
  module Buff
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZPH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-09 00:00:00.000000000 Z
11
+ date: 2013-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec