Class: Interpark::Book::Configuration

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

Constant Summary collapse

API_HOST =
"http://book.interpark.com"
CONFIGURABLE_ATTRIBUTES =
[
  :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/interpark/book/client.rb', line 19

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

Class Method Details

.configurable_attributesObject



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

def self.configurable_attributes
  CONFIGURABLE_ATTRIBUTES
end

Instance Method Details

#attributes=(attrs = {}) ⇒ Object



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

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

#dataObject



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

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

#httpObject



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

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