dambalah-twitter4r 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +124 -0
- data/MIT-LICENSE +20 -0
- data/README +32 -0
- data/TODO +9 -0
- data/lib/twitter.rb +31 -0
- data/lib/twitter/client.rb +21 -0
- data/lib/twitter/client/account.rb +24 -0
- data/lib/twitter/client/auth.rb +27 -0
- data/lib/twitter/client/base.rb +87 -0
- data/lib/twitter/client/blocks.rb +35 -0
- data/lib/twitter/client/favorites.rb +53 -0
- data/lib/twitter/client/friendship.rb +47 -0
- data/lib/twitter/client/messaging.rb +79 -0
- data/lib/twitter/client/status.rb +46 -0
- data/lib/twitter/client/timeline.rb +72 -0
- data/lib/twitter/client/user.rb +87 -0
- data/lib/twitter/config.rb +71 -0
- data/lib/twitter/console.rb +28 -0
- data/lib/twitter/core.rb +137 -0
- data/lib/twitter/ext.rb +2 -0
- data/lib/twitter/ext/stdlib.rb +51 -0
- data/lib/twitter/extras.rb +39 -0
- data/lib/twitter/meta.rb +56 -0
- data/lib/twitter/model.rb +344 -0
- data/lib/twitter/rails.rb +92 -0
- data/lib/twitter/version.rb +19 -0
- data/spec/twitter/client/auth_spec.rb +34 -0
- data/spec/twitter/client/base_spec.rb +242 -0
- data/spec/twitter/client/blocks_spec.rb +76 -0
- data/spec/twitter/client/favorites_spec.rb +183 -0
- data/spec/twitter/client/friendship_spec.rb +76 -0
- data/spec/twitter/client/messaging_spec.rb +135 -0
- data/spec/twitter/client/status_spec.rb +92 -0
- data/spec/twitter/client/timeline_spec.rb +79 -0
- data/spec/twitter/client/user_spec.rb +203 -0
- data/spec/twitter/client_spec.rb +2 -0
- data/spec/twitter/config_spec.rb +86 -0
- data/spec/twitter/console_spec.rb +15 -0
- data/spec/twitter/core_spec.rb +127 -0
- data/spec/twitter/ext/stdlib_spec.rb +42 -0
- data/spec/twitter/extras_spec.rb +46 -0
- data/spec/twitter/meta_spec.rb +90 -0
- data/spec/twitter/model_spec.rb +464 -0
- data/spec/twitter/rails_spec.rb +110 -0
- data/spec/twitter/version_spec.rb +19 -0
- metadata +109 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
+
|
3
|
+
describe String, "representing a class name" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@class_name = Twitter::User.class.name
|
7
|
+
@xmlized_name = @class_name.downcase # simple case for the moment...since Rails' support for namespaced models sucks!
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be downcased (minus module namespaces) when xmlized" do
|
11
|
+
@class_name.xmlize.should eql(@xmlized_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
after(:each) do
|
15
|
+
nilize(@class_name, @xmlized_name)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "Rails model extensions for model classes", :shared => true do
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
@id = 3242334
|
23
|
+
@id_s = @id.to_s
|
24
|
+
@model = model(@id)
|
25
|
+
@model_hash = @model.to_hash
|
26
|
+
@json = JSON.unparse(@model_hash)
|
27
|
+
@serializer = ActiveRecord::XmlSerializer.new(@model, {:root => @model.class.name.downcase})
|
28
|
+
@xml = @serializer.to_s
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should invoke #to_param as expected" do
|
32
|
+
@model.should_receive(:id).and_return(@id)
|
33
|
+
@model.to_param
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return string representation for id for #to_param" do
|
37
|
+
@model.to_param.class.should eql(String)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return output from JSON.unparse for #to_json" do
|
41
|
+
@model.should_receive(:to_hash).and_return(@model_hash)
|
42
|
+
JSON.should_receive(:unparse).and_return(@json)
|
43
|
+
@model.to_json
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should return XmlSerializer string output for #to_xml" do
|
47
|
+
ActiveRecord::XmlSerializer.should_receive(:new).and_return(@serializer)
|
48
|
+
@serializer.should_receive(:to_s).and_return(@xml)
|
49
|
+
@model.to_xml
|
50
|
+
end
|
51
|
+
|
52
|
+
after(:each) do
|
53
|
+
nilize(@id, @model)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe Twitter::User, "Rails extensions" do
|
58
|
+
|
59
|
+
def model(id)
|
60
|
+
Twitter::User.new(:id => id)
|
61
|
+
end
|
62
|
+
|
63
|
+
it_should_behave_like "Rails model extensions for model classes"
|
64
|
+
end
|
65
|
+
|
66
|
+
describe Twitter::Status, "Rails extensions" do
|
67
|
+
|
68
|
+
def model(id)
|
69
|
+
Twitter::Status.new(:id => id)
|
70
|
+
end
|
71
|
+
|
72
|
+
it_should_behave_like "Rails model extensions for model classes"
|
73
|
+
end
|
74
|
+
|
75
|
+
describe Twitter::Message, "Rails extensions" do
|
76
|
+
|
77
|
+
def model(id)
|
78
|
+
Twitter::Message.new(:id => id)
|
79
|
+
end
|
80
|
+
|
81
|
+
it_should_behave_like "Rails model extensions for model classes"
|
82
|
+
end
|
83
|
+
|
84
|
+
describe Twitter::RESTError, "Rails extensions" do
|
85
|
+
|
86
|
+
before(:each) do
|
87
|
+
@attributes = { :code => 200, :message => 'Success', :uri => 'http://twitter.com/statuses' }
|
88
|
+
@model = Twitter::RESTError.new(@attributes)
|
89
|
+
@json = "JSON" # doesn't really matter what the value is
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should return a Hash of attribute name-value pairs for #to_hash" do
|
93
|
+
@model.to_hash.should === @attributes
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should invoke XmlSerializer for #to_xml" do
|
97
|
+
|
98
|
+
@model.to_xml
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should return expected JSON for #to_json" do
|
102
|
+
@model.to_hash
|
103
|
+
JSON.should_receive(:unparse).and_return(@json)
|
104
|
+
@model.to_json
|
105
|
+
end
|
106
|
+
|
107
|
+
after(:each) do
|
108
|
+
nilize(@attributes, @model)
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
+
|
3
|
+
VERSION_LIST = [Twitter::Version::MAJOR, Twitter::Version::MINOR, Twitter::Version::REVISION]
|
4
|
+
|
5
|
+
EXPECTED_VERSION = VERSION_LIST.join('.')
|
6
|
+
EXPECTED_NAME = VERSION_LIST.join('_')
|
7
|
+
|
8
|
+
describe Twitter::Version, ".to_version" do
|
9
|
+
it "should return #{EXPECTED_VERSION}" do
|
10
|
+
Twitter::Version.to_version.should eql(EXPECTED_VERSION)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe Twitter::Version, ".to_name" do
|
15
|
+
it "should return #{EXPECTED_NAME}" do
|
16
|
+
Twitter::Version.to_name.should eql(EXPECTED_NAME)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dambalah-twitter4r
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Susan Potter
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-02-13 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: json
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.1.1
|
24
|
+
version:
|
25
|
+
description:
|
26
|
+
email: twitter4r-users@googlegroups.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README
|
33
|
+
- CHANGES
|
34
|
+
- TODO
|
35
|
+
- MIT-LICENSE
|
36
|
+
files:
|
37
|
+
- lib/twitter/extras.rb
|
38
|
+
- lib/twitter/config.rb
|
39
|
+
- lib/twitter/core.rb
|
40
|
+
- lib/twitter/client/blocks.rb
|
41
|
+
- lib/twitter/client/account.rb
|
42
|
+
- lib/twitter/client/timeline.rb
|
43
|
+
- lib/twitter/client/messaging.rb
|
44
|
+
- lib/twitter/client/base.rb
|
45
|
+
- lib/twitter/client/favorites.rb
|
46
|
+
- lib/twitter/client/status.rb
|
47
|
+
- lib/twitter/client/friendship.rb
|
48
|
+
- lib/twitter/client/auth.rb
|
49
|
+
- lib/twitter/client/user.rb
|
50
|
+
- lib/twitter/rails.rb
|
51
|
+
- lib/twitter/client.rb
|
52
|
+
- lib/twitter/console.rb
|
53
|
+
- lib/twitter/version.rb
|
54
|
+
- lib/twitter/model.rb
|
55
|
+
- lib/twitter/meta.rb
|
56
|
+
- lib/twitter/ext.rb
|
57
|
+
- lib/twitter/ext/stdlib.rb
|
58
|
+
- lib/twitter.rb
|
59
|
+
- spec/twitter/config_spec.rb
|
60
|
+
- spec/twitter/core_spec.rb
|
61
|
+
- spec/twitter/model_spec.rb
|
62
|
+
- spec/twitter/client/status_spec.rb
|
63
|
+
- spec/twitter/client/timeline_spec.rb
|
64
|
+
- spec/twitter/client/auth_spec.rb
|
65
|
+
- spec/twitter/client/user_spec.rb
|
66
|
+
- spec/twitter/client/messaging_spec.rb
|
67
|
+
- spec/twitter/client/base_spec.rb
|
68
|
+
- spec/twitter/client/favorites_spec.rb
|
69
|
+
- spec/twitter/client/friendship_spec.rb
|
70
|
+
- spec/twitter/client/blocks_spec.rb
|
71
|
+
- spec/twitter/version_spec.rb
|
72
|
+
- spec/twitter/rails_spec.rb
|
73
|
+
- spec/twitter/client_spec.rb
|
74
|
+
- spec/twitter/meta_spec.rb
|
75
|
+
- spec/twitter/console_spec.rb
|
76
|
+
- spec/twitter/extras_spec.rb
|
77
|
+
- spec/twitter/ext/stdlib_spec.rb
|
78
|
+
- README
|
79
|
+
- CHANGES
|
80
|
+
- TODO
|
81
|
+
- MIT-LICENSE
|
82
|
+
has_rdoc: true
|
83
|
+
homepage: http://twitter4r.rubyforge.org
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: "0"
|
94
|
+
version:
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: "0"
|
100
|
+
version:
|
101
|
+
requirements: []
|
102
|
+
|
103
|
+
rubyforge_project: twitter4r
|
104
|
+
rubygems_version: 1.2.0
|
105
|
+
signing_key:
|
106
|
+
specification_version: 2
|
107
|
+
summary: A clean Twitter client API in pure Ruby. Will include Twitter add-ons also in Ruby. (This version has changes made by Luc Castera)
|
108
|
+
test_files: []
|
109
|
+
|