Class: Mailroute::Client

Inherits:
Object show all
Defined in:
lib/mailroute/check_connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(username, apikey) ⇒ Client

Returns a new instance of Client.



3
4
5
6
# File 'lib/mailroute/check_connection.rb', line 3

def initialize(username, apikey)
  @username = username
  @apikey = apikey
end

Instance Method Details

#check_connectionObject



8
9
10
11
12
13
14
# File 'lib/mailroute/check_connection.rb', line 8

def check_connection
  response = RestClient.get 'https://admin-dev.mailroute.net/api/v1/reseller/',
                            'Accept' => 'application/json',
                            'Content-Type' => 'application/json',
                            'Authorization' => "ApiKey #@username:#@apikey"
  response.code == 200
end