Class: Interpark::Book::Configuration
- Inherits:
-
Object
- Object
- Interpark::Book::Configuration
- 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
- #attributes=(attrs = {}) ⇒ Object
- #data ⇒ Object
- #http ⇒ Object
-
#initialize(attrs = {}) ⇒ Configuration
constructor
A new instance of Configuration.
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_attributes ⇒ Object
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 |
#data ⇒ Object
35 36 37 |
# File 'lib/interpark/book/client.rb', line 35 def data @data = {"key" => @key} end |
#http ⇒ Object
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 |