Class: Mypeople::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/mypeople/client.rb

Constant Summary collapse

CONFIGURABLE_ATTRIBUTES =
[
  :host,
  :key
]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Configuration

Returns a new instance of Configuration.



18
19
20
# File 'lib/mypeople/client.rb', line 18

def initialize(attrs = {})
  self.attributes = attrs
end

Class Method Details

.configurable_attributesObject



14
15
16
# File 'lib/mypeople/client.rb', line 14

def self.configurable_attributes
  CONFIGURABLE_ATTRIBUTES
end

Instance Method Details

#attributes=(attrs = {}) ⇒ Object



22
23
24
# File 'lib/mypeople/client.rb', line 22

def attributes=(attrs = {})
  attrs.each { |key, value| instance_variable_set("@#{key}", value)  }
end

#dataObject



34
35
36
# File 'lib/mypeople/client.rb', line 34

def data
  @data = {"apikey" => @key}
end

#httpObject



26
27
28
29
30
31
32
# File 'lib/mypeople/client.rb', line 26

def http
  uri = URI.parse(self.host)
  @http ||= Net::HTTP.new(uri.host, uri.port)
  @http.use_ssl = true
  @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  @http
end