class PanasonicRcs::Connection

Attributes

host[R]
log[RW]

Public Class Methods

new(username: '', password: '', log: nil, adapter: [:net_http]) click to toggle source
# File lib/panasonic_rcs/connection.rb, line 9
def initialize(username: '', password: '', log: nil, adapter: [:net_http])
  @conn = Faraday.new(url: "https://provisioning.e-connecting.net/") do |builder|
    builder.use Faraday::Request::BasicAuthentication, username, password
    builder.use FaradayMiddleware::ParseXml, content_type: /\bxml$/
    builder.use Faraday::Response::Logger, log if log
    builder.adapter *adapter
  end
end

Public Instance Methods

post(body) click to toggle source
# File lib/panasonic_rcs/connection.rb, line 18
def post(body)
  @conn.post do |req|
    req.url '/redirect/xmlrpc'
    req.headers['Content-Type'] = 'text/xml'
    req.body = body
  end
end