jnunemaker-twitter 0.3.5 → 0.3.6

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/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ 0.3.6 - August 11, 2008
2
+ * Fixed a few more methods that required post.
3
+ * Refactored the remaining methods that were not using #request to use it.
4
+
5
+ 0.3.5 - August 4, 2008
6
+ * Removed sqlite-ruby 1.2.2 as a dependency due to install issues on linux
7
+
1
8
  0.3.4 - August 3, 2008
2
9
  * Added search support
3
10
 
data/Manifest.txt CHANGED
@@ -13,6 +13,7 @@ examples/friends_followers.rb
13
13
  examples/friendships.rb
14
14
  examples/identica_timeline.rb
15
15
  examples/location.rb
16
+ examples/posting.rb
16
17
  examples/replies.rb
17
18
  examples/search.rb
18
19
  examples/sent_messages.rb
@@ -6,21 +6,23 @@ twitter = Twitter::Base.new(config['email'], config['password'])
6
6
 
7
7
  puts 'SINCE'
8
8
  twitter.direct_messages(:since => Time.now - 5.day).each do |s|
9
- puts "- #{s.text}"
9
+ puts "- #{s.id} #{s.text}"
10
10
  end
11
11
  puts
12
12
  puts
13
13
 
14
- puts 'SINCE_ID'
15
- twitter.direct_messages(:since_id => 33505386).each do |s|
16
- puts "- #{s.text}"
17
- end
18
- puts
19
- puts
14
+ # puts 'SINCE_ID'
15
+ # twitter.direct_messages(:since_id => 33505386).each do |s|
16
+ # puts "- #{s.text}"
17
+ # end
18
+ # puts
19
+ # puts
20
+ #
21
+ # puts 'PAGE'
22
+ # twitter.direct_messages(:page => 1).each do |s|
23
+ # puts "- #{s.text}"
24
+ # end
25
+ # puts
26
+ # puts
20
27
 
21
- puts 'PAGE'
22
- twitter.direct_messages(:page => 1).each do |s|
23
- puts "- #{s.text}"
24
- end
25
- puts
26
- puts
28
+ # puts twitter.destroy_direct_message(34489057).inspect
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ twitter = Twitter::Base.new(config['email'], config['password'])
6
+ puts twitter.post("This is a test from the example file").inspect
7
+
8
+ # sending a direct message
9
+ # puts twitter.d('jnunemaker', 'this is a test').inspect
data/lib/twitter/base.rb CHANGED
@@ -86,17 +86,12 @@ module Twitter
86
86
 
87
87
  # destroys a give direct message by id if the auth user is a recipient
88
88
  def destroy_direct_message(id)
89
- request("direct_messages/destroy/#{id}.xml", :auth => true)
89
+ DirectMessage.new_from_xml(request("direct_messages/destroy/#{id}.xml", :auth => true, :method => :post))
90
90
  end
91
91
 
92
92
  # Sends a direct message <code>text</code> to <code>user</code>
93
93
  def d(user, text)
94
- url = URI.parse("http://#{@api_host}/direct_messages/new.xml")
95
- req = Net::HTTP::Post.new(url.path)
96
- req.basic_auth(@config[:email], @config[:password])
97
- req.set_form_data({'text' => text, 'user' => user})
98
- response = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }
99
- DirectMessage.new_from_xml(parse(response.body).at('direct_message'))
94
+ DirectMessage.new_from_xml(request('direct_messages/new.xml', :auth => true, :method => :post, :form_data => {'text' => text, 'user' => user}))
100
95
  end
101
96
 
102
97
  # Befriends id_or_screenname for the auth user
@@ -164,12 +159,7 @@ module Twitter
164
159
  def post(status, options={})
165
160
  form_data = {'status' => status}
166
161
  form_data.merge({'source' => options[:source]}) if options[:source]
167
- url = URI.parse("http://#{@api_host}/statuses/update.xml")
168
- req = Net::HTTP::Post.new(url.path)
169
- req.basic_auth(@config[:email], @config[:password])
170
- req.set_form_data(form_data)
171
- response = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }
172
- Status.new_from_xml(parse(response.body).at('status'))
162
+ Status.new_from_xml(request('statuses/update.xml', :auth => true, :method => :post, :form_data => form_data))
173
163
  end
174
164
  alias :update :post
175
165
 
@@ -219,6 +209,9 @@ module Twitter
219
209
  klass = Net::HTTP.const_get options[:method].to_s.downcase.capitalize
220
210
  req = klass.new("#{uri.path}/#{path}", options[:headers])
221
211
  req.basic_auth(@config[:email], @config[:password]) if options[:auth]
212
+ if options[:method].to_s == 'post' && options[:form_data]
213
+ req.set_form_data(options[:form_data])
214
+ end
222
215
  http.request(req)
223
216
  end
224
217
  rescue => error
@@ -2,7 +2,7 @@ module Twitter #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 5
5
+ TINY = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,3 +1,12 @@
1
+ desc 'Preps the gem for a new release'
2
+ task :prep_for_release do
3
+ require 'rio'
4
+ Rake::Task['manifest:refresh'].invoke
5
+ gemspec = %x[rake debug_gem]
6
+ lines = gemspec.split("\n")
7
+ rio('twitter.gemspec') < lines[1, lines.length-1].join("\n")
8
+ end
9
+
1
10
  desc 'Release the website and new gem version'
2
11
  task :deploy => [:check_version, :website, :release] do
3
12
  puts "Remember to create SVN tag:"
data/twitter.gemspec CHANGED
@@ -1,16 +1,16 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{twitter}
3
- s.version = "0.3.5"
3
+ s.version = "0.3.6"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["John Nunemaker"]
7
- s.date = %q{2008-08-04}
7
+ s.date = %q{2008-08-11}
8
8
  s.default_executable = %q{twitter}
9
9
  s.description = %q{a command line interface for twitter, also a library which wraps the twitter api}
10
10
  s.email = %q{nunemaker@gmail.com}
11
11
  s.executables = ["twitter"]
12
12
  s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt"]
13
- s.files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/twitter", "config/hoe.rb", "config/requirements.rb", "examples/blocks.rb", "examples/direct_messages.rb", "examples/favorites.rb", "examples/friends_followers.rb", "examples/friendships.rb", "examples/identica_timeline.rb", "examples/location.rb", "examples/replies.rb", "examples/search.rb", "examples/sent_messages.rb", "examples/timeline.rb", "examples/twitter.rb", "examples/verify_credentials.rb", "lib/twitter.rb", "lib/twitter/base.rb", "lib/twitter/cli.rb", "lib/twitter/cli/config.rb", "lib/twitter/cli/helpers.rb", "lib/twitter/cli/migrations/20080722194500_create_accounts.rb", "lib/twitter/cli/migrations/20080722194508_create_tweets.rb", "lib/twitter/cli/migrations/20080722214605_add_account_id_to_tweets.rb", "lib/twitter/cli/migrations/20080722214606_create_configurations.rb", "lib/twitter/cli/models/account.rb", "lib/twitter/cli/models/configuration.rb", "lib/twitter/cli/models/tweet.rb", "lib/twitter/direct_message.rb", "lib/twitter/easy_class_maker.rb", "lib/twitter/rate_limit_status.rb", "lib/twitter/search.rb", "lib/twitter/status.rb", "lib/twitter/user.rb", "lib/twitter/version.rb", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "spec/base_spec.rb", "spec/cli/helper_spec.rb", "spec/direct_message_spec.rb", "spec/fixtures/followers.xml", "spec/fixtures/friends.xml", "spec/fixtures/friends_for.xml", "spec/fixtures/friends_lite.xml", "spec/fixtures/friends_timeline.xml", "spec/fixtures/public_timeline.xml", "spec/fixtures/rate_limit_status.xml", "spec/fixtures/search_results.json", "spec/fixtures/status.xml", "spec/fixtures/user.xml", "spec/fixtures/user_timeline.xml", "spec/search_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/status_spec.rb", "spec/user_spec.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/website.rake", "twitter.gemspec", "website/css/common.css", "website/images/terminal_output.png", "website/index.html"]
13
+ s.files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/twitter", "config/hoe.rb", "config/requirements.rb", "examples/blocks.rb", "examples/direct_messages.rb", "examples/favorites.rb", "examples/friends_followers.rb", "examples/friendships.rb", "examples/identica_timeline.rb", "examples/location.rb", "examples/posting.rb", "examples/replies.rb", "examples/search.rb", "examples/sent_messages.rb", "examples/timeline.rb", "examples/twitter.rb", "examples/verify_credentials.rb", "lib/twitter.rb", "lib/twitter/base.rb", "lib/twitter/cli.rb", "lib/twitter/cli/config.rb", "lib/twitter/cli/helpers.rb", "lib/twitter/cli/migrations/20080722194500_create_accounts.rb", "lib/twitter/cli/migrations/20080722194508_create_tweets.rb", "lib/twitter/cli/migrations/20080722214605_add_account_id_to_tweets.rb", "lib/twitter/cli/migrations/20080722214606_create_configurations.rb", "lib/twitter/cli/models/account.rb", "lib/twitter/cli/models/configuration.rb", "lib/twitter/cli/models/tweet.rb", "lib/twitter/direct_message.rb", "lib/twitter/easy_class_maker.rb", "lib/twitter/rate_limit_status.rb", "lib/twitter/search.rb", "lib/twitter/status.rb", "lib/twitter/user.rb", "lib/twitter/version.rb", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "spec/base_spec.rb", "spec/cli/helper_spec.rb", "spec/direct_message_spec.rb", "spec/fixtures/followers.xml", "spec/fixtures/friends.xml", "spec/fixtures/friends_for.xml", "spec/fixtures/friends_lite.xml", "spec/fixtures/friends_timeline.xml", "spec/fixtures/public_timeline.xml", "spec/fixtures/rate_limit_status.xml", "spec/fixtures/search_results.json", "spec/fixtures/status.xml", "spec/fixtures/user.xml", "spec/fixtures/user_timeline.xml", "spec/search_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/status_spec.rb", "spec/user_spec.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/website.rake", "twitter.gemspec", "website/css/common.css", "website/images/terminal_output.png", "website/index.html"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{http://twitter.rubyforge.org}
16
16
  s.rdoc_options = ["--main", "README.txt"]
@@ -46,4 +46,4 @@ Gem::Specification.new do |s|
46
46
  s.add_dependency(%q<activerecord>, [">= 2.1"])
47
47
  s.add_dependency(%q<httparty>, [">= 0.1.0"])
48
48
  end
49
- end
49
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jnunemaker-twitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-04 00:00:00 -07:00
12
+ date: 2008-08-11 00:00:00 -07:00
13
13
  default_executable: twitter
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -93,6 +93,7 @@ files:
93
93
  - examples/friendships.rb
94
94
  - examples/identica_timeline.rb
95
95
  - examples/location.rb
96
+ - examples/posting.rb
96
97
  - examples/replies.rb
97
98
  - examples/search.rb
98
99
  - examples/sent_messages.rb