jugyo-rubytter 0.4.8 → 0.5.0
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/lib/rubytter.rb +9 -4
- data/spec/rubytter_spec.rb +6 -1
- metadata +1 -1
data/lib/rubytter.rb
CHANGED
|
@@ -16,9 +16,7 @@ class Rubytter
|
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
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' => "
|
|
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
|
data/spec/rubytter_spec.rb
CHANGED
|
@@ -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', "
|
|
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
|