Class: BasecampAPI::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/basecamp/basecamp.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Connection

Returns a new instance of Connection.



152
153
154
155
156
157
# File 'lib/basecamp/basecamp.rb', line 152

def initialize(master)
  @master = master
  @connection = Net::HTTP.new(master.site, master.use_ssl ? 443 : 80)
  @connection.use_ssl = master.use_ssl
  @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE if master.use_ssl
end

Instance Method Details

#post(path, body, headers = {}) ⇒ Object



159
160
161
162
163
# File 'lib/basecamp/basecamp.rb', line 159

def post(path, body, headers = {})
  request = Net::HTTP::Post.new(path, headers.merge('Accept' => 'application/xml'))
  request.basic_auth(@master.user, @master.password)
  @connection.request(request, body)
end