jugyo-rubytter 0.4.8 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/rubytter.rb +9 -4
  2. data/spec/rubytter_spec.rb +6 -1
  3. metadata +1 -1
data/lib/rubytter.rb CHANGED
@@ -16,9 +16,7 @@ class Rubytter
16
16
  end
17
17
  end
18
18
 
19
- APP_NAME = 'Rubytter'
20
- VERSION = '0.4.8'
21
- HOMEPAGE = 'http://github.com/jugyo/rubytter'
19
+ VERSION = '0.5.0'
22
20
 
23
21
  attr_reader :login
24
22
  attr_accessor :host, :header
@@ -27,8 +25,9 @@ class Rubytter
27
25
  @login = login
28
26
  @password = password
29
27
  @host = options[:host] || 'twitter.com'
30
- @header = {'User-Agent' => "#{APP_NAME}/#{VERSION} (#{HOMEPAGE})"}
28
+ @header = {'User-Agent' => "Rubytter/#{VERSION} (http://github.com/jugyo/rubytter)"}
31
29
  @header.merge!(options[:header]) if options[:header]
30
+ @app_name = options[:app_name]
32
31
  @connection = Connection.new(options)
33
32
  end
34
33
 
@@ -88,6 +87,12 @@ class Rubytter
88
87
  end
89
88
  end
90
89
 
90
+ alias_method :__update_status, :update_status
91
+ def update_status(params = {})
92
+ params[:source] = @app_name if @app_name
93
+ __update_status(params)
94
+ end
95
+
91
96
  def update(status, params = {})
92
97
  update_status(params.merge({:status => status}))
93
98
  end
@@ -142,7 +142,7 @@ class Rubytter
142
142
 
143
143
  it 'should set default header' do
144
144
  rubytter = Rubytter.new('test', 'test')
145
- rubytter.header.should == {'User-Agent', "#{APP_NAME}/#{VERSION} (#{HOMEPAGE})"}
145
+ rubytter.header.should == {'User-Agent', "Rubytter/#{VERSION} (http://github.com/jugyo/rubytter)"}
146
146
  end
147
147
 
148
148
  it 'should able to set custom header 1' do
@@ -192,5 +192,10 @@ class Rubytter
192
192
  lambda {struct.regex}.should raise_error(NoMethodError)
193
193
  end
194
194
 
195
+ it 'should be set app_name' do
196
+ rubytter = Rubytter.new('test', 'teat', :app_name => "Foo")
197
+ rubytter.should_receive(:__update_status).with({:status => 'test', :source => "Foo"})
198
+ rubytter.update('test')
199
+ end
195
200
  end
196
201
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jugyo-rubytter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jugyo