Class: StackConnect
- Inherits:
-
Object
- Object
- StackConnect
- Defined in:
- lib/stackconnect.rb
Constant Summary collapse
- @@VERSION =
"0.0.7"- @@api =
'http://api.stackexchange.com/'- @@site =
'stackoverflow'- @@uri =
URI(@@api)
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
-
#site ⇒ Object
Returns the value of attribute site.
-
#uri ⇒ Object
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
- #retrieve_day_popular_tags(from_date) ⇒ Object
- #retrieve_most_popular_tags ⇒ Object
- #retrieve_total_questions(from_date) ⇒ Object
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
6 7 8 |
# File 'lib/stackconnect.rb', line 6 def api @api end |
#site ⇒ Object
Returns the value of attribute site.
6 7 8 |
# File 'lib/stackconnect.rb', line 6 def site @site end |
#uri ⇒ Object
Returns the value of attribute uri.
6 7 8 |
# File 'lib/stackconnect.rb', line 6 def uri @uri end |
Class Method Details
.return_version ⇒ Object
32 33 34 |
# File 'lib/stackconnect.rb', line 32 def self.return_version @@VERSION end |
Instance Method Details
#retrieve_day_popular_tags(from_date) ⇒ Object
26 27 28 29 30 |
# File 'lib/stackconnect.rb', line 26 def (from_date) @@uri.path = '/2.1/tags' @@uri.query = ({ :fromdate => from_date, :site=>'stackoverflow', :sort => 'activity', :order=>'desc'}).to_query data = JSON.parse(@@uri.open.read) end |
#retrieve_most_popular_tags ⇒ Object
20 21 22 23 24 |
# File 'lib/stackconnect.rb', line 20 def @@uri.path = '/2.1/tags' @@uri.query = ({ :order=>'desc', :sort=>'popular', :site=>@@site}).to_query data = JSON.parse(@@uri.open.read) end |
#retrieve_total_questions(from_date) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/stackconnect.rb', line 13 def retrieve_total_questions(from_date) @@uri.path = '/2.1/questions' @@uri.query = ({:site=>@@site, :filter=>'!--Me6hWI5gUs', :fromdate=>from_date}).to_query data = JSON.parse(@@uri.open.read) count = data["total"] end |