Module: Vhx::ApiOperations::Create::ClassMethods
- Defined in:
- lib/vhx/utilities/api_operations/create.rb
Instance Method Summary collapse
Instance Method Details
#create(payload, headers = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/vhx/utilities/api_operations/create.rb', line 5 def create(payload, headers = {}) klass = get_klass response = Vhx.connection.post do |req| req.url('/' + klass.downcase + 's') # This url is based purely on VHX's API convention. if headers.length > 0 headers.each do |key, value| req.headers[key] = value end end req.body = payload end self.new(response.body) end |