twitter4r 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,7 +51,7 @@ class Twitter::Client
51
51
  uri = @@MESSAGING_URIS[action]
52
52
  case action
53
53
  when :post
54
- response = http_connect({:text => value, :user => user.to_i}.to_http_str) {|conn| create_http_post_request(uri) }
54
+ response = http_connect({:text => value, :user => user.to_i, :source => @@config.source}.to_http_str) {|conn| create_http_post_request(uri) }
55
55
  when :delete
56
56
  response = http_connect {|conn| create_http_delete_request(uri, :id => value.to_i) }
57
57
  end
@@ -30,7 +30,7 @@ class Twitter::Client
30
30
  when :get
31
31
  response = http_connect {|conn| create_http_get_request(uri, :id => value.to_i) }
32
32
  when :post
33
- response = http_connect({:status => value}.to_http_str) {|conn| create_http_post_request(uri) }
33
+ response = http_connect({:status => value, :source => @@config.source}.to_http_str) {|conn| create_http_post_request(uri) }
34
34
  when :delete
35
35
  response = http_connect {|conn| create_http_delete_request(uri, :id => value.to_i) }
36
36
  end
@@ -30,6 +30,7 @@ module Twitter
30
30
  :application_name,
31
31
  :application_version,
32
32
  :application_url,
33
+ :source,
33
34
  ]
34
35
  attr_accessor *@@ATTRIBUTES
35
36
 
@@ -54,6 +55,7 @@ module Twitter
54
55
  :application_name => 'Twitter4R',
55
56
  :application_version => Twitter::Version.to_version,
56
57
  :application_url => 'http://twitter4r.rubyforge.org',
58
+ :source => 'twitter4r',
57
59
  }
58
60
  @@config = Twitter::Config.new(@@defaults)
59
61
 
@@ -4,7 +4,7 @@
4
4
  module Twitter::Version #:nodoc:
5
5
  MAJOR = 0
6
6
  MINOR = 2
7
- REVISION = 0
7
+ REVISION = 1
8
8
  class << self
9
9
  # Returns X.Y.Z formatted version string
10
10
  def to_version
@@ -52,12 +52,14 @@ describe Twitter::Client, "#message" do
52
52
  @json = JSON.unparse(@attributes)
53
53
  @response = mas_net_http_response(:success, @json)
54
54
  @connection = mas_net_http(@response)
55
+ @source = Twitter::Client.class_eval("@@defaults[:source]")
56
+
55
57
  Net::HTTP.stub!(:new).and_return(@connection)
56
58
  Twitter::Message.stub!(:unmarshal).and_return(@message)
57
59
  end
58
60
 
59
61
  it "should invoke #http_connect with expected arguments for :post case" do
60
- @twitter.should_receive(:http_connect).with({:text => @message.text, :user => @message.recipient.to_i}.to_http_str).and_return(@response)
62
+ @twitter.should_receive(:http_connect).with({:text => @message.text, :user => @message.recipient.to_i, :source => @source}.to_http_str).and_return(@response)
61
63
  @twitter.message(:post, @message.text, @message.recipient)
62
64
  end
63
65
 
@@ -11,6 +11,7 @@ describe Twitter::Client, "#status" do
11
11
  @connection = mas_net_http(@response)
12
12
  @float = 43.3434
13
13
  @status = Twitter::Status.new(:id => 2349343)
14
+ @source = Twitter::Client.class_eval("@@defaults[:source]")
14
15
  end
15
16
 
16
17
  it "should return nil if nil is passed as value argument for :get case" do
@@ -50,7 +51,7 @@ describe Twitter::Client, "#status" do
50
51
 
51
52
  it "should create expected HTTP POST request for :post case" do
52
53
  @twitter.should_receive(:create_http_post_request).with(@uris[:post]).and_return(@request)
53
- @connection.should_receive(:request).with(@request, {:status => @message}.to_http_str).and_return(@response)
54
+ @connection.should_receive(:request).with(@request, {:status => @message, :source => @source}.to_http_str).and_return(@response)
54
55
  @twitter.status(:post, @message)
55
56
  end
56
57
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: twitter4r
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.0
7
- date: 2007-07-08 00:00:00 -05:00
6
+ version: 0.2.1
7
+ date: 2007-07-17 00:00:00 -05:00
8
8
  summary: A clean Twitter client API in pure Ruby. Will include Twitter add-ons also in Ruby.
9
9
  require_paths:
10
10
  - lib