Class: Iprofiler::Client

Inherits:
Object
  • Object
show all
Includes:
Api::QueryMethods
Defined in:
lib/iprofiler/client.rb

Constant Summary collapse

CONNECTION_PARAMETERS =
[:api_key, :api_secret, :api_host]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Api::QueryMethods

#company_lookup

Constructor Details

#initialize(api_key = Iprofiler.api_key, api_secret = Iprofiler.api_secret, api_host = Iprofiler.api_host) ⇒ Client

Returns a new instance of Client.



23
24
25
26
27
28
# File 'lib/iprofiler/client.rb', line 23

def initialize(api_key=Iprofiler.api_key, api_secret=Iprofiler.api_secret, api_host=Iprofiler.api_host)
  @api_key = api_key
  @api_secret = api_secret
  @api_host = api_host
  validate_credential_presence
end

Instance Attribute Details

#api_hostObject (readonly)

Returns the value of attribute api_host.



13
14
15
# File 'lib/iprofiler/client.rb', line 13

def api_host
  @api_host
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



13
14
15
# File 'lib/iprofiler/client.rb', line 13

def api_key
  @api_key
end

#api_secretObject (readonly)

Returns the value of attribute api_secret.



13
14
15
# File 'lib/iprofiler/client.rb', line 13

def api_secret
  @api_secret
end

#missing_credentialsObject (readonly)

Returns the value of attribute missing_credentials.



13
14
15
# File 'lib/iprofiler/client.rb', line 13

def missing_credentials
  @missing_credentials
end

Instance Method Details

#valid_credentials?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/iprofiler/client.rb', line 30

def valid_credentials?
  credentials_present? && (company_lookup({}).code == 200)
end