rubyoverflow 1.0.2 → 2.0.2.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/.gitignore +5 -0
  2. data/.rvmrc +47 -0
  3. data/.travis.yml +5 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE +1 -1
  6. data/README.rdoc +14 -20
  7. data/RELEASENOTES +1 -97
  8. data/Rakefile +7 -49
  9. data/lib/rubyoverflow.rb +46 -108
  10. data/lib/rubyoverflow/answers.rb +5 -57
  11. data/lib/rubyoverflow/base.rb +21 -68
  12. data/lib/rubyoverflow/questions.rb +5 -101
  13. data/lib/rubyoverflow/sites.rb +18 -0
  14. data/lib/rubyoverflow/stats.rb +8 -0
  15. data/lib/rubyoverflow/users.rb +5 -70
  16. data/lib/rubyoverflow/version.rb +3 -0
  17. data/rubyoverflow.gemspec +26 -0
  18. data/spec/answers_spec.rb +13 -0
  19. data/spec/questions_spec.rb +13 -0
  20. data/spec/sites_spec.rb +18 -0
  21. data/spec/spec_helper.rb +3 -0
  22. data/spec/stats_spec.rb +12 -0
  23. data/spec/users_spec.rb +23 -0
  24. metadata +94 -121
  25. data/VERSION +0 -1
  26. data/lib/rubyoverflow/answer.rb +0 -61
  27. data/lib/rubyoverflow/apiSite.rb +0 -32
  28. data/lib/rubyoverflow/apiSites.rb +0 -25
  29. data/lib/rubyoverflow/apiVersion.rb +0 -6
  30. data/lib/rubyoverflow/badge.rb +0 -44
  31. data/lib/rubyoverflow/badgeCounts.rb +0 -22
  32. data/lib/rubyoverflow/badges.rb +0 -59
  33. data/lib/rubyoverflow/comment.rb +0 -41
  34. data/lib/rubyoverflow/comments.rb +0 -115
  35. data/lib/rubyoverflow/errors.rb +0 -17
  36. data/lib/rubyoverflow/pagedBase.rb +0 -27
  37. data/lib/rubyoverflow/pagedDash.rb +0 -7
  38. data/lib/rubyoverflow/postTimelineEvent.rb +0 -93
  39. data/lib/rubyoverflow/postTimelineEvents.rb +0 -39
  40. data/lib/rubyoverflow/question.rb +0 -110
  41. data/lib/rubyoverflow/repChange.rb +0 -34
  42. data/lib/rubyoverflow/repChanges.rb +0 -41
  43. data/lib/rubyoverflow/revision.rb +0 -62
  44. data/lib/rubyoverflow/revisions.rb +0 -52
  45. data/lib/rubyoverflow/statistics.rb +0 -57
  46. data/lib/rubyoverflow/styling.rb +0 -19
  47. data/lib/rubyoverflow/tag.rb +0 -27
  48. data/lib/rubyoverflow/tags.rb +0 -46
  49. data/lib/rubyoverflow/user.rb +0 -181
  50. data/lib/rubyoverflow/userTimelineEvent.rb +0 -43
  51. data/lib/rubyoverflow/userTimelineEvents.rb +0 -35
  52. data/test/apiKey.rb +0 -5
  53. data/test/helper.rb +0 -159
  54. data/test/test_answer.rb +0 -20
  55. data/test/test_answers.rb +0 -32
  56. data/test/test_badge.rb +0 -18
  57. data/test/test_badges.rb +0 -30
  58. data/test/test_base.rb +0 -63
  59. data/test/test_statistics.rb +0 -26
  60. data/test/test_user.rb +0 -56
  61. data/test/test_users.rb +0 -37
@@ -0,0 +1,3 @@
1
+ require 'rubyoverflow'
2
+ require 'rspec'
3
+ include Rubyoverflow
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + "/spec_helper"
2
+
3
+ describe Stats do
4
+ before(:each) do
5
+ @client = Client.new
6
+ end
7
+
8
+ it "retrieves stats" do
9
+ result = @client.stats.fetch
10
+ result.should respond_to(:statistics)
11
+ end
12
+ end
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + "/spec_helper"
2
+
3
+ describe Users do
4
+ before(:each) do
5
+ @client = Client.new
6
+ end
7
+
8
+ it "retrieves users" do
9
+ result = @client.users.fetch
10
+ result.should respond_to(:users)
11
+ result.page.should == 1
12
+ end
13
+
14
+ it "retrieves Dan Seaver" do
15
+ result = @client.users.fetch(:id => 53587)
16
+ result.users.first.display_name.should == 'Dan Seaver'
17
+ end
18
+
19
+ it "retrieves multiple users by an array of ids" do
20
+ result = @client.users.fetch(:id => [53587,22656])
21
+ result.total.should == 2
22
+ end
23
+ end
metadata CHANGED
@@ -1,157 +1,130 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rubyoverflow
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 2
9
- version: 1.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.2.pre1
5
+ prerelease: 6
10
6
  platform: ruby
11
- authors:
12
- - phsr
7
+ authors:
8
+ - Dan Seaver
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-04-19 00:00:00 -04:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: httparty
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2011-12-08 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: &2161893000 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
31
22
  type: :runtime
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ version_requirements: *2161893000
25
+ - !ruby/object:Gem::Dependency
34
26
  name: hashie
27
+ requirement: &2161892340 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
35
34
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
35
+ version_requirements: *2161892340
36
+ - !ruby/object:Gem::Dependency
37
+ name: json
38
+ requirement: &2161891920 !ruby/object:Gem::Requirement
37
39
  none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
44
  type: :runtime
45
- version_requirements: *id002
46
- - !ruby/object:Gem::Dependency
45
+ prerelease: false
46
+ version_requirements: *2161891920
47
+ - !ruby/object:Gem::Dependency
47
48
  name: rspec
49
+ requirement: &2161891380 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
48
56
  prerelease: false
49
- requirement: &id003 !ruby/object:Gem::Requirement
57
+ version_requirements: *2161891380
58
+ - !ruby/object:Gem::Dependency
59
+ name: rake
60
+ requirement: &2161890960 !ruby/object:Gem::Requirement
50
61
  none: false
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- segments:
55
- - 0
56
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
57
66
  type: :development
58
- version_requirements: *id003
59
- description: rubyoverflow is a library for querying the Stack Overflow API
60
- email: phasor@phsr.org
67
+ prerelease: false
68
+ version_requirements: *2161890960
69
+ description: Rubyoverflow is a Ruby wrapper for the Stack Exchange APIs
70
+ email:
71
+ - git@danseaver.com
61
72
  executables: []
62
-
63
73
  extensions: []
64
-
65
- extra_rdoc_files:
66
- - LICENSE
67
- - README.rdoc
68
- files:
74
+ extra_rdoc_files: []
75
+ files:
69
76
  - .document
77
+ - .gitignore
78
+ - .rvmrc
79
+ - .travis.yml
80
+ - Gemfile
70
81
  - LICENSE
71
82
  - README.rdoc
72
83
  - RELEASENOTES
73
84
  - Rakefile
74
- - VERSION
75
85
  - lib/rubyoverflow.rb
76
- - lib/rubyoverflow/answer.rb
77
86
  - lib/rubyoverflow/answers.rb
78
- - lib/rubyoverflow/apiSite.rb
79
- - lib/rubyoverflow/apiSites.rb
80
- - lib/rubyoverflow/apiVersion.rb
81
- - lib/rubyoverflow/badge.rb
82
- - lib/rubyoverflow/badgeCounts.rb
83
- - lib/rubyoverflow/badges.rb
84
87
  - lib/rubyoverflow/base.rb
85
- - lib/rubyoverflow/comment.rb
86
- - lib/rubyoverflow/comments.rb
87
- - lib/rubyoverflow/errors.rb
88
- - lib/rubyoverflow/pagedBase.rb
89
- - lib/rubyoverflow/pagedDash.rb
90
- - lib/rubyoverflow/postTimelineEvent.rb
91
- - lib/rubyoverflow/postTimelineEvents.rb
92
- - lib/rubyoverflow/question.rb
93
88
  - lib/rubyoverflow/questions.rb
94
- - lib/rubyoverflow/repChange.rb
95
- - lib/rubyoverflow/repChanges.rb
96
- - lib/rubyoverflow/revision.rb
97
- - lib/rubyoverflow/revisions.rb
98
- - lib/rubyoverflow/statistics.rb
99
- - lib/rubyoverflow/styling.rb
100
- - lib/rubyoverflow/tag.rb
101
- - lib/rubyoverflow/tags.rb
102
- - lib/rubyoverflow/user.rb
103
- - lib/rubyoverflow/userTimelineEvent.rb
104
- - lib/rubyoverflow/userTimelineEvents.rb
89
+ - lib/rubyoverflow/sites.rb
90
+ - lib/rubyoverflow/stats.rb
105
91
  - lib/rubyoverflow/users.rb
106
- - test/apiKey.rb
107
- - test/helper.rb
108
- - test/test_answer.rb
109
- - test/test_answers.rb
110
- - test/test_badge.rb
111
- - test/test_badges.rb
112
- - test/test_base.rb
113
- - test/test_statistics.rb
114
- - test/test_user.rb
115
- - test/test_users.rb
116
- has_rdoc: true
117
- homepage: http://github.com/phsr/rubyoverflow
92
+ - lib/rubyoverflow/version.rb
93
+ - rubyoverflow.gemspec
94
+ - spec/answers_spec.rb
95
+ - spec/questions_spec.rb
96
+ - spec/sites_spec.rb
97
+ - spec/spec_helper.rb
98
+ - spec/stats_spec.rb
99
+ - spec/users_spec.rb
100
+ homepage: ''
118
101
  licenses: []
119
-
120
102
  post_install_message:
121
103
  rdoc_options: []
122
-
123
- require_paths:
104
+ require_paths:
124
105
  - lib
125
- required_ruby_version: !ruby/object:Gem::Requirement
106
+ required_ruby_version: !ruby/object:Gem::Requirement
126
107
  none: false
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- segments:
131
- - 0
132
- version: "0"
133
- required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
113
  none: false
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- segments:
139
- - 0
140
- version: "0"
114
+ requirements:
115
+ - - ! '>'
116
+ - !ruby/object:Gem::Version
117
+ version: 1.3.1
141
118
  requirements: []
142
-
143
- rubyforge_project:
144
- rubygems_version: 1.3.7
119
+ rubyforge_project: rubyoverflow
120
+ rubygems_version: 1.8.11
145
121
  signing_key:
146
122
  specification_version: 3
147
- summary: rubyoverflow is a library for querying the Stack Overflow API
148
- test_files:
149
- - test/helper.rb
150
- - test/test_answer.rb
151
- - test/test_answers.rb
152
- - test/test_badge.rb
153
- - test/test_badges.rb
154
- - test/test_base.rb
155
- - test/test_statistics.rb
156
- - test/test_user.rb
157
- - test/test_users.rb
123
+ summary: Rubyoverflow is a Ruby wrapper for the Stack Exchange APIs
124
+ test_files:
125
+ - spec/answers_spec.rb
126
+ - spec/questions_spec.rb
127
+ - spec/sites_spec.rb
128
+ - spec/spec_helper.rb
129
+ - spec/stats_spec.rb
130
+ - spec/users_spec.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.0.2
@@ -1,61 +0,0 @@
1
- module Rubyoverflow
2
- class Answer < Base
3
- attr_reader :answer_id, :accepted, :answer_comments_url, :question_id, :locked_date, :owner,
4
- :creation_date, :last_edit_date, :last_activity_date, :up_vote_count, :down_vote_count,
5
- :view_count, :score, :community_owned, :title, :body, :comments
6
-
7
- def initialize(hash, request_path = '')
8
- dash = AnswerDash.new hash
9
-
10
- @answer_id = dash.answer_id
11
- @accepted = dash.accepted
12
- @answer_comments_url = dash.answer_comments_url
13
- @question_id = dash.question_id
14
- @locked_date = dash.locked_date
15
- @owner = User.new dash.owner
16
- @creation_date = dash.creation_date
17
- @last_edit_date = dash.last_edit_date
18
- @last_activity_date = dash.last_activity_date
19
- @up_vote_count = dash.up_vote_count
20
- @down_vote_count = dash.down_vote_count
21
- @view_count = dash.view_count
22
- @score = dash.score
23
- @community_owned = dash.community_owned
24
- @title = dash.title
25
- @body = dash.body
26
- @comments = Comments.new dash.comments if dash.comments
27
- end
28
-
29
- #Gets the comments made on the answer
30
- def get_comments(parameters = {})
31
- if @answer_comments_url
32
- hash,url =request(@answer_comments_url, parameters)
33
- Comments.new hash, url
34
- else
35
- nil
36
- end
37
- end
38
-
39
- end
40
-
41
- class AnswerDash < BaseDash
42
-
43
- property :answer_id
44
- property :accepted
45
- property :answer_comments_url
46
- property :question_id
47
- property :locked_date
48
- property :owner
49
- property :creation_date
50
- property :last_edit_date
51
- property :last_activity_date
52
- property :up_vote_count
53
- property :down_vote_count
54
- property :view_count
55
- property :score
56
- property :community_owned
57
- property :title
58
- property :body
59
- property :comments
60
- end
61
- end
@@ -1,32 +0,0 @@
1
- module Rubyoverflow
2
- class ApiSite
3
- attr_reader :name, :logo_url, :api_endpoint, :site_url, :description, :icon_url, :state, :styling, :aliases
4
-
5
- def initialize(hash,url='')
6
- dash = ApiSiteDash.new hash
7
-
8
- @name = dash.name
9
- @logo_url = dash.logo_url
10
- @api_endpoint = dash.api_endpoint
11
- @site_url = dash.site_url
12
- @description = dash.description
13
- @icon_url = dash.icon_url
14
- @state = dash.state
15
- @styling = Styling.new dash.styling if dash.styling
16
- @aliases = dash.aliases
17
- end
18
-
19
- end
20
-
21
- class ApiSiteDash < BaseDash
22
- property :aliases
23
- property :name
24
- property :logo_url
25
- property :api_endpoint
26
- property :site_url
27
- property :description
28
- property :icon_url
29
- property :state
30
- property :styling
31
- end
32
- end
@@ -1,25 +0,0 @@
1
- module Rubyoverflow
2
- class ApiSites < Base
3
- attr_reader :api_sites
4
- def initialize(hash, url = '')
5
- mash = ApiSitesDash.new hash
6
- @api_sites = Array.new
7
-
8
- mash.api_sites.each{|siteHash| @api_sites.push(ApiSite.new siteHash)}
9
- end
10
-
11
- class << self
12
- def retrieve_sites()
13
- client = Client.stackauth_client(Base.client.api_key)
14
-
15
- hash,url = client.request('sites',{})
16
-
17
- ApiSites.new hash,url
18
- end
19
- end
20
- end
21
-
22
- class ApiSitesDash < BaseDash
23
- property :api_sites
24
- end
25
- end
@@ -1,6 +0,0 @@
1
- module Rubyoverflow
2
- class ApiVersion < BaseDash
3
- property :version
4
- property :revision
5
- end
6
- end
@@ -1,44 +0,0 @@
1
- module Rubyoverflow
2
- class Badge < Base
3
- attr_reader :badge_id, :rank, :name, :description, :award_count, :tag_based, :user, :badges_recipients_url
4
-
5
- def initialize(hash, request_path = '')
6
- dash = BadgeDash.new hash
7
-
8
- @badge_id = dash.badge_id
9
- @rank = dash.rank
10
- @name = dash.name
11
- @description = dash.description
12
- @award_count = dash.award_count
13
- @tag_based = dash.tag_based
14
- @user = User.new dash.user if dash.user
15
- @badges_recipients_url = dash.badges_recipients_url
16
- end
17
-
18
- def item_id
19
- @badge_id
20
- end
21
-
22
- #Retrieves all the users that have received the badge
23
- def get_recipients(parameters = {})
24
- if @badges_recipients_url
25
- hash,url =request(@badges_recipients_url, parameters)
26
- Users.new hash, url
27
- else
28
- nil
29
- end
30
- end
31
-
32
- end
33
-
34
- class BadgeDash < BaseDash
35
- property :badge_id
36
- property :rank
37
- property :name
38
- property :description
39
- property :award_count
40
- property :tag_based
41
- property :user
42
- property :badges_recipients_url
43
- end
44
- end