Class: Vibe::Client
Constant Summary
Constants included from Request
Constants included from Configuration
Vibe::Configuration::DEFAULT_API_KEY, Vibe::Configuration::DEFAULT_CACHE, Vibe::Configuration::DEFAULT_CACHE_DRIVER, Vibe::Configuration::DEFAULT_ENDPOINT, Vibe::Configuration::DEFAULT_FORMAT, Vibe::Configuration::DEFAULT_METHOD, Vibe::Configuration::DEFAULT_USER_AGENT, Vibe::Configuration::VALID_CONFIG_KEYS, Vibe::Configuration::VALID_CONNECTION_KEYS, Vibe::Configuration::VALID_OPTIONS_KEYS
Instance Method Summary collapse
-
#get_data(email) ⇒ String
Get Data from an Email.
-
#initialize(options = {}, &block) ⇒ Client
constructor
A new instance of Client.
-
#stats(api_key = nil) ⇒ String
Get Stats for API Key.
Methods included from Request
Methods included from Configuration
#configure, extended, #options, #reset
Constructor Details
#initialize(options = {}, &block) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vibe/client.rb', line 10 def initialize( = {}, &block) # Merge the config values from the module and those passed # to the client. = Vibe..merge() # Copy the merged values and ignore those # not part of our configuration Configuration::VALID_CONFIG_KEYS.each do |key| puts "Setting Configuration: #{key}" if ENV['DEBUG'] send("#{key}=", [key]) if Configuration::VALID_OPTIONS_KEYS.include? key send("#{key}=", Vibe.[key]) if Configuration::VALID_CONNECTION_KEYS.include? key end self.instance_eval(&block) if block_given? end |
Instance Method Details
#get_data(email) ⇒ String
Get Data from an Email
29 30 31 32 33 34 35 36 |
# File 'lib/vibe/client.rb', line 29 def get_data(email) if !email.is_a? String error = InvalidOptions.new(['Email(String)'], ['Email(String)']) raise error end get_request '/profile_lookup/', :person_email => email end |
#stats(api_key = nil) ⇒ String
Get Stats for API Key
41 42 43 44 45 46 47 48 49 |
# File 'lib/vibe/client.rb', line 41 def stats(api_key = nil) if api_key && (!api_key.is_a? String) error = InvalidOptions.new(['API key(String)'], ['API key(String)']) raise error end # Disable cache for API key status calls get_request('/stats/', {:key => api_key}, true) end |