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.



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

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

Class Method Details

.configurable_attributesObject



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

def self.configurable_attributes
  CONFIGURABLE_ATTRIBUTES
end

Instance Method Details

#attributes=(attrs = {}) ⇒ Object



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

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

#dataObject



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

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

#httpObject



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

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