class SuapApi::Connect
Public Class Methods
new(username, password)
click to toggle source
# File lib/suap_api/connect.rb, line 3 def initialize(username, password) @username = username @password = password end
Public Instance Methods
get_json_by_uri(uri)
click to toggle source
# File lib/suap_api/connect.rb, line 8 def get_json_by_uri(uri) mechanize = Mechanize.new mechanize.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE page = mechanize.get(SuapApi::BASE_URL) form = page.forms.first form['username'] = @username form['password'] = @password page = form.submit api = mechanize.get("#{BASE_URL}#{uri}") api.body end