rubytter 0.6.3 → 0.6.4
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 +10 -2
- data/spec/rubytter_spec.rb +6 -0
- metadata +2 -2
data/lib/rubytter.rb
CHANGED
@@ -16,7 +16,7 @@ class Rubytter
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
VERSION = '0.6.
|
19
|
+
VERSION = '0.6.4'
|
20
20
|
|
21
21
|
attr_reader :login
|
22
22
|
attr_accessor :host, :header
|
@@ -184,7 +184,7 @@ class Rubytter
|
|
184
184
|
end
|
185
185
|
end
|
186
186
|
unless struct_values.empty?
|
187
|
-
|
187
|
+
get_struct(struct_values.keys).new(*struct_values.values)
|
188
188
|
else
|
189
189
|
nil
|
190
190
|
end
|
@@ -197,4 +197,12 @@ class Rubytter
|
|
197
197
|
raise ArgumentError, 'Argument must be a Hash object' unless hash.is_a?(Hash)
|
198
198
|
hash.to_a.map{|i| i[0].to_s + '=' + CGI.escape(i[1].to_s) }.join('&')
|
199
199
|
end
|
200
|
+
|
201
|
+
def self.get_struct(keys)
|
202
|
+
@@structs ||= {}
|
203
|
+
unless @@structs.has_key?(keys)
|
204
|
+
@@structs[keys] = Struct.new(*keys)
|
205
|
+
end
|
206
|
+
@@structs[keys]
|
207
|
+
end
|
200
208
|
end
|
data/spec/rubytter_spec.rb
CHANGED
@@ -193,6 +193,12 @@ class Rubytter
|
|
193
193
|
lambda {struct.regex}.should raise_error(NoMethodError)
|
194
194
|
end
|
195
195
|
|
196
|
+
it 'should create same structs from same datas' do
|
197
|
+
Rubytter.json_to_struct({:a => 'a'}).should == Rubytter.json_to_struct({:a => 'a'})
|
198
|
+
Rubytter.json_to_struct({:a => 'a', :b => {:c => 'c'}}).should ==
|
199
|
+
Rubytter.json_to_struct({:a => 'a', :b => {:c => 'c'}})
|
200
|
+
end
|
201
|
+
|
196
202
|
it 'should be set app_name' do
|
197
203
|
rubytter = Rubytter.new('test', 'teat', :app_name => "Foo")
|
198
204
|
rubytter.should_receive(:__update_status).with({:status => 'test', :source => "Foo"})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubytter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jugyo
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-22 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|