Method: Atomsphere::Api::Client#post

Defined in:
lib/atomsphere/api/client.rb

#post(path, data) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/atomsphere/api/client.rb', line 13

def post path, data
  header = {
    'Content-Type' => 'application/json',
    'Accept'       => ' application/json'
  }

  request = Net::HTTP::Post.new api_uri(path), header
  request.body = (String === data ? data : data.to_json)
  request.basic_auth config.username, config.password

  http_request request
end