class NeonMob

Constants

URL

Public Class Methods

new(username, password) click to toggle source
   # File lib/neon_mob.rb
 7 def initialize(username, password)
 8   @password = password
 9   @username = username
10 end

Public Instance Methods

login() click to toggle source
   # File lib/neon_mob.rb
12 def login
13   @login = post('/api/signin/', login_params).parse
14 end

Private Instance Methods

build_url(path) click to toggle source
   # File lib/neon_mob.rb
33 def build_url(path)
34   URL.tap do |uri|
35     uri.path = path
36   end.to_s
37 end
logged_in?() click to toggle source
   # File lib/neon_mob.rb
18 def logged_in?
19   @login['code'].nil?
20 end
login_params() click to toggle source
   # File lib/neon_mob.rb
22 def login_params
23   {
24     :password => @password,
25     :username => @username,
26   }
27 end
post(path, params = {}) click to toggle source
   # File lib/neon_mob.rb
29 def post(path, params = {})
30   HTTP[:accept => "application/json"].post(build_url(path), :json => params)
31 end