Class: StackConnect

Inherits:
Object
  • Object
show all
Defined in:
lib/stackconnect.rb

Constant Summary collapse

@@VERSION =
"0.0.1"
@@api =
'http://api.stackexchange.com/'
@@site =
'stackoverflow'
@@uri =
URI(@@api)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#apiObject

Returns the value of attribute api.



6
7
8
# File 'lib/stackconnect.rb', line 6

def api
  @api
end

#siteObject

Returns the value of attribute site.



6
7
8
# File 'lib/stackconnect.rb', line 6

def site
  @site
end

#uriObject

Returns the value of attribute uri.



6
7
8
# File 'lib/stackconnect.rb', line 6

def uri
  @uri
end

Class Method Details

.return_versionObject



20
21
22
# File 'lib/stackconnect.rb', line 20

def self.return_version
  @@VERSION
end

Instance Method Details

#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