Class: XivelyConnector::Connection
- Inherits:
-
Xively::Client
- Object
- Xively::Client
- XivelyConnector::Connection
- Includes:
- Logger
- Defined in:
- lib/xively-rb-connector/connection.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(options) ⇒ Connection
constructor
A new instance of Connection.
-
#set_httparty_options(options = {}) ⇒ Object
Set HTTParty params that we need to set after initialize is called These params come from @options within initialize and include the following: :ssl_ca_file - SSL CA File for SSL connections :format - ‘json’, ‘xml’, ‘html’, etc.
Methods included from Logger
configure_logger_for, logger, #logger
Constructor Details
#initialize(options) ⇒ Connection
Returns a new instance of Connection.
14 15 16 17 18 19 |
# File 'lib/xively-rb-connector/connection.rb', line 14 def initialize() @logger = [:logger] || logger #@config = options[:config] || Configuration.new @logger.debug "XivelyConnector::Connection initialize" super([:api_key]) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
12 13 14 |
# File 'lib/xively-rb-connector/connection.rb', line 12 def config @config end |
Instance Method Details
#set_httparty_options(options = {}) ⇒ Object
Set HTTParty params that we need to set after initialize is called These params come from @options within initialize and include the following: :ssl_ca_file - SSL CA File for SSL connections :format - ‘json’, ‘xml’, ‘html’, etc. || Defaults to ‘xml’ :format_header - :format Header string || Defaults to ‘application/xml’ :pem_cert - /path/to/a/pem_formatted_certificate.pem for SSL connections :pem_cert_pass - plaintext password, not recommended!
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/xively-rb-connector/connection.rb', line 29 def (={}) if [:ssl_ca_file] ssl_ca_file opts[:ssl_ca_file] if [:pem_cert_pass] pem File.read([:pem_cert]), [:pem_cert_pass] else pem File.read([:pem_cert]) end end end |