ttt-client 0.1.0 → 0.2.1

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: 4c6fbaf970c3e611402ee7d0b67b9133ea5ff318
4
- data.tar.gz: db6e3bd8fb7727c74df166c0404bffd4dba06f3e
3
+ metadata.gz: 85d61e2150cf0180526c80bd5b4963b0f6597b86
4
+ data.tar.gz: 011de8143003d66cecaa338311d5059f67509dec
5
5
  SHA512:
6
- metadata.gz: c835dc3b713adb836972247d281e98582fb2ba0cb913c3a19efc1a05f7a9160b12c94a54ebdc53ed55a6ee7363c9b2530b80cd31ead1e05fb692f8014f3e25c1
7
- data.tar.gz: abb01a380f5823c2e07fc056b5f3ee2d8f74f776bcade390ba56d8e565be868a46cd56066660aefb6c6241d286c4a140bc9a3733c557723591ed058918e10342
6
+ metadata.gz: 06c51ad9cee1fe7e924714f8af3678cfc5d476ca1269b42cae2eefedcdce625105834369228cfeab78eaec08ad9fe3b6c9150321cefbbe67d387f405dc21253d
7
+ data.tar.gz: 13b5acf707fa65548b877424aa43b0674d4557b23a39dada6dfe4e7946fd9b03b1f14cbbcdd3845854eb917ba8314d9c167dc984e5de547f0aa95f7e75f8b522
data/README.md CHANGED
@@ -1,10 +1,15 @@
1
1
  tech teen twitter CLI
2
2
  ======================
3
3
 
4
+ [![Dependency Status](http://img.shields.io/gemnasium/probablyjosh/ttt.svg)](https://gemnasium.com/probablyjosh/ttt)
5
+ [![Gem Version](http://img.shields.io/gem/v/ttt-client.svg)](https://rubygems.org/gems/ttt-client)
6
+ [![License](http://img.shields.io/:license-mit-blue.svg)](http://probablyjosh.mit-license.org)
7
+
8
+
4
9
  a Twitter CLI for the future steve jobs'.
5
10
 
6
11
  usage
7
- ======
12
+ -----
8
13
 
9
14
  ```bash
10
15
  gem install ttt-client
@@ -14,15 +19,26 @@ ttt [arguments]
14
19
  rake isn't working with this project (at least to install gems) because i'm stupid
15
20
 
16
21
  goal
17
- ====
22
+ ----
18
23
 
19
24
  make a CLI Twitter client that you can only interact with members of
20
25
  teen tech twitter with
21
26
 
22
27
  docs
23
- ====
28
+ ----
29
+
30
+ ### tweet
31
+ tweet text to a user
32
+ ```bash
33
+ ttt tweet --user jfkingsley --body 'jon you tech teeeen'
34
+ ```
35
+
36
+ ### get members
37
+ see the members in teen tech twitter. these are the only users you can tweet to
24
38
 
25
- update later
39
+ ```bash
40
+ ttt members
41
+ ```
26
42
 
27
43
 
28
44
  contribution
data/lib/ttt.rb CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  # Require gems
5
5
  require 'twitter'
6
- require 'colorize'
7
6
  require 'json'
8
7
  require 'commander/import'
9
8
  require_relative 'ttt/version'
@@ -12,25 +11,26 @@ program :name, 'teen tech twitter client'
12
11
  program :version, Ttt::Version::STRING
13
12
  program :description, 'The official Twitter CLI for Tech Teen Twitter'
14
13
 
14
+ file = ENV['HOME'] + '/.ttt_keys.json'
15
+ if File.file? file
16
+ keys = JSON.parse(File.read(file))
17
+ client = Twitter::REST::Client.new do |config|
18
+ config.consumer_key = keys['consumer_key']
19
+ config.consumer_secret = keys['consumer_secret']
20
+ config.access_token = keys['access_token']
21
+ config.access_token_secret = keys['access_token_secret']
22
+ end
23
+ end
24
+
15
25
  command :init do |c|
16
26
  c.syntax = 'ttt init'
17
27
  c.description = 'Initializes ~/.ttt_keys.json'
18
28
  c.action do
19
- keys = {}
20
- print "Consumer key: "
21
- keys[:consumer_key] = STDIN.gets.chomp
22
- print "Consumer secret: "
23
- keys[:consumer_secret] = STDIN.gets.chomp
24
- print "Access Token: "
25
- keys[:access_token] = STDIN.gets.chomp
26
- print "Access Token Secret: "
27
- keys[:access_token_secret] = STDIN.gets.chomp
28
-
29
29
  tempHash = {
30
- :consumer_key => keys[:consumer_key],
31
- :consumer_secret => keys[:consumer_secret],
32
- :access_token => keys[:access_token],
33
- :access_token_secret => keys[:access_token_secret],
30
+ :consumer_key => ask("Consumer key: "),
31
+ :consumer_secret => ask("Consumer secret: "),
32
+ :access_token => ask("Access Token: "),
33
+ :access_token_secret => ask("Access Token Secret: ")
34
34
  }
35
35
 
36
36
  file = ENV['HOME'] + '/.ttt_keys.json'
@@ -38,3 +38,36 @@ command :init do |c|
38
38
  puts "Keys written to #{file}"
39
39
  end
40
40
  end
41
+
42
+ command :members do |c|
43
+ c.syntax = 'ttt members'
44
+ c.description = 'Lists TTT\'s current members'
45
+ c.action do
46
+ client.lists.each do |list|
47
+ if list.name == "Teen Tech Twitter"
48
+ client.list_members(list).each {|user| puts user.screen_name }
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ command :tweet do |c|
55
+ c.syntax = 'ttt tweet'
56
+ c.description = 'Tweets to a specified user in the list'
57
+ c.option '--user STRING', String, 'The user you want to tweet to'
58
+ c.option '--body STRING', String, 'The body of the tweet'
59
+ c.action do |args, options|
60
+ client.lists.each do |list|
61
+ if list.name == "Teen Tech Twitter"
62
+ members = []
63
+ client.list_members(list).each { |user| members << user.screen_name }
64
+ if members.include? options.user
65
+ client.update('@' + options.user + ' ' + options.body)
66
+ puts "Success: #{options.user} is a tech teen"
67
+ else
68
+ puts "Error: #{options.user} is not a tech teen"
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
data/lib/ttt/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Ttt
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 1
5
- PATCH = 0
4
+ MINOR = 2
5
+ PATCH = 1
6
6
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  end
8
8
  end
data/ttt.gemspec CHANGED
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_runtime_dependency 'twitter', '~> 5.14', '>= 5.14.0'
22
- spec.add_runtime_dependency "colorize", "~> 0.7.5"
23
22
  spec.add_runtime_dependency "commander", "~> 4.3.0", '>= 4.3.0'
24
23
 
25
24
  spec.add_development_dependency "bundler", "~> 1.8"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ttt-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Trommel
@@ -30,20 +30,6 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 5.14.0
33
- - !ruby/object:Gem::Dependency
34
- name: colorize
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: 0.7.5
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: 0.7.5
47
33
  - !ruby/object:Gem::Dependency
48
34
  name: commander
49
35
  requirement: !ruby/object:Gem::Requirement
@@ -107,7 +93,6 @@ files:
107
93
  - Rakefile
108
94
  - bin/ttt
109
95
  - lib/ttt.rb
110
- - lib/ttt/extra.rb
111
96
  - lib/ttt/version.rb
112
97
  - ttt.gemspec
113
98
  homepage: https://github.com/probablyjosh/ttt
data/lib/ttt/extra.rb DELETED
@@ -1,27 +0,0 @@
1
- # Read & parse JSON for keys
2
- file = File.read ENV['HOME'] + '/.ttt_keys.json'
3
- keys = JSON.parse file
4
-
5
- client = Twitter::REST::Client.new do |config|
6
- config.consumer_key = keys['consumer_key']
7
- config.consumer_secret = keys['consumer_secret']
8
- config.access_token = keys['access_token']
9
- config.access_token_secret = keys['access_token_secret']
10
- end
11
-
12
- client.lists.each do |list|
13
- if list.name == "Teen Tech Twitter"
14
-
15
- # Header and description
16
- puts list.name.colorize(:blue)
17
- puts list.description.colorize(:green)
18
-
19
- # Print list members
20
- client.list_members(list).each do |user|
21
- print '@' + user.screen_name + ' '
22
- end
23
-
24
- puts
25
-
26
- end
27
- end