class NMA::Request

Public Class Methods

new() click to toggle source
# File lib/ruby-notify-my-android/request.rb, line 10
def initialize
  @url = "https://www.notifymyandroid.com/publicapi"
end

Public Instance Methods

call(command, params) click to toggle source

Make the actual call to the api

# File lib/ruby-notify-my-android/request.rb, line 15
def call(command, params)
  @command = command
  request = Net::HTTP::Get.new(uri.request_uri + "?" + params)
  response = http.request(request)
  Response.new(response)
end

Private Instance Methods

http() click to toggle source
# File lib/ruby-notify-my-android/request.rb, line 23
def http
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  http
end
uri() click to toggle source
# File lib/ruby-notify-my-android/request.rb, line 30
def uri
  URI.parse("#{@url}/#{@command}")
end