twitter-console 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in twitter-cli.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Christopher Burnett
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Twitter::Console
2
+
3
+ An interactive console for the [Twitter API](https://dev.twitter.com/) built on the [twitter](http://github.com/sferik/twitter) gem.
4
+
5
+ ## Installation
6
+
7
+ $ gem install twitter-console
8
+
9
+ Add the following environment variables to `.bash_profile` or `.zshenv`
10
+
11
+ export TWITTER_CONSUMER_KEY=<YOUR KEY>
12
+ export TWITTER_CONSUMER_SECRET=<YOUR SECRET>
13
+ export TWITTER_OAUTH_TOKEN=<YOUR TOKEN>
14
+ export TWITTER_OAUTH_TOKEN_SECRET=<YOUR OAUTH SECRET>
15
+
16
+ ## Usage
17
+
18
+ Invoke the console from your shell and start interacting with the Twitter API.
19
+
20
+ $ twitter-console
21
+ > Twitter Console -- Type `usage` for examples.
22
+ >
23
+ > api.get('/1/users/show.json?screen_name=twoism')
24
+ => {:profile_background_tile=>false:default_profile_image=>false, :description=>"i build things at twitter. \r\n\r\ntweets dictated but not read.", :id=>15786115, :profile_use_background_image=>true, :favourites_count=>337, :created_at=>"Sat Aug 09 03:42:43 +0000 2008", :listed_count=>25}
25
+
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'rubygems'
6
+ require 'twitter'
7
+ require 'twitter-console'
8
+ require 'irb'
9
+
10
+ include Twitter::Console
11
+
12
+ start
data/lib/.DS_Store ADDED
Binary file
@@ -0,0 +1,57 @@
1
+ require "twitter-console/version"
2
+
3
+
4
+ module Twitter
5
+ module Console
6
+ class ClientProxy < Twitter::Client
7
+ [:get, :post, :put, :delete].each do |http_method|
8
+ class_eval %Q[
9
+ def #{http_method}(*args)
10
+ super(*args)[:body]
11
+ end]
12
+ end
13
+ end
14
+
15
+ BANNER = "Twitter Console-- Type `usage` for examples."
16
+ USAGE = %Q{
17
+ Fetch a user
18
+ api.get('/1/users/show.json?screen_name=<screen_name>')
19
+
20
+ Image uploads
21
+ image = File.open("/path/to/banner.png")
22
+ api.post('/1/account/profile_banner.json', :banner => image)
23
+
24
+ }.gsub(/^\t{4}/,'')
25
+
26
+ def usage
27
+ print USAGE
28
+ end
29
+
30
+ def endpoint
31
+ ENV['TWITTER_API_ENDPOINT'] || Twitter::Default::ENDPOINT
32
+ end
33
+
34
+ def api
35
+ @api ||= ClientProxy.new(:endpoint => endpoint)
36
+ end
37
+
38
+ def start
39
+ puts BANNER
40
+
41
+ IRB.setup(nil)
42
+ irb = IRB::Irb.new
43
+
44
+ IRB.conf[:MAIN_CONTEXT] = irb.context
45
+
46
+ irb.context.evaluate("require 'irb/completion'", 0)
47
+
48
+ trap("SIGINT") do
49
+ irb.signal_handle
50
+ end
51
+
52
+ catch(:IRB_EXIT) do
53
+ irb.eval_input
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,5 @@
1
+ module Twitter
2
+ module Cli
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/twitter-console/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Christopher Burnett"]
6
+ gem.email = ["signalstatic@gmail.com"]
7
+ gem.description = %q{Console for the Twitter Gem}
8
+ gem.summary = %q{Interactive console for the Twitter API}
9
+ gem.homepage = "http://github.com/twoism/twitter-console"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "twitter-console"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Twitter::Cli::VERSION
17
+
18
+ gem.add_dependency 'twitter'
19
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: twitter-console
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Christopher Burnett
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-11-02 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: twitter
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: Console for the Twitter Gem
36
+ email:
37
+ - signalstatic@gmail.com
38
+ executables:
39
+ - twitter-console
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .DS_Store
46
+ - .gitignore
47
+ - Gemfile
48
+ - LICENSE
49
+ - README.md
50
+ - Rakefile
51
+ - bin/twitter-console
52
+ - lib/.DS_Store
53
+ - lib/twitter-console.rb
54
+ - lib/twitter-console/version.rb
55
+ - twitter-console.gemspec
56
+ has_rdoc: true
57
+ homepage: http://github.com/twoism/twitter-console
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options: []
62
+
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 3
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ requirements: []
84
+
85
+ rubyforge_project:
86
+ rubygems_version: 1.6.2
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: Interactive console for the Twitter API
90
+ test_files: []
91
+