Class: Session
- Inherits:
-
Object
- Object
- Session
- Defined in:
- lib/zooline/session.rb
Constant Summary collapse
- KEY =
"061a7cdae8f28a5db3368eaf782db2c8"
- BASEURL =
"http://zootool.com/api"
Instance Method Summary collapse
- #get(offset = nil, limit = nil) ⇒ Object
-
#initialize ⇒ Session
constructor
A new instance of Session.
- #password=(k) ⇒ Object
- #username=(k) ⇒ Object
Constructor Details
#initialize ⇒ Session
Returns a new instance of Session.
5 6 7 8 9 10 11 12 |
# File 'lib/zooline/session.rb', line 5 def initialize @sess = Patron::Session.new @sess.timeout = 10 @sess.base_url = BASEURL @sess.headers['User-Agent'] = 'Zooline/0.01' @sess.enable_debug "/tmp/patron.debug" @sess.auth_type = :digest end |
Instance Method Details
#get(offset = nil, limit = nil) ⇒ Object
22 23 24 |
# File 'lib/zooline/session.rb', line 22 def get(offset = nil, limit = nil) @sess.get("/users/items?username=#{@sess.username}&apikey=#{KEY}&login=true&offset=0&limit=1000").body end |
#password=(k) ⇒ Object
18 19 20 |
# File 'lib/zooline/session.rb', line 18 def password=(k) @sess.password = k end |
#username=(k) ⇒ Object
14 15 16 |
# File 'lib/zooline/session.rb', line 14 def username=(k) @sess.username = k end |