Module: NetsuiteApi::Concerns::RequestHandler

Included in:
NetsuiteApi::Contact, NetsuiteApi::CreditMemo, NetsuiteApi::Customer, Invoice, Payment, Vendor, VendorBill
Defined in:
lib/netsuite_api/concerns/request_handler.rb

Instance Method Summary collapse

Instance Method Details

#create(body) ⇒ Object



10
11
12
13
# File 'lib/netsuite_api/concerns/request_handler.rb', line 10

def create(body)
  response = request("#{self.class::PATH}", body: body, method: :post, host_type: :netsuite_host)
  post_and_patch_response_handler(response)
end

#delete(id) ⇒ Object



20
21
22
23
# File 'lib/netsuite_api/concerns/request_handler.rb', line 20

def delete(id)
  response = request("#{self.class::PATH}/#{id}", method: :delete, host_type: :netsuite_host)
  delete_response_handler(response)
end

#get(id, query_params: nil) ⇒ Object



5
6
7
8
# File 'lib/netsuite_api/concerns/request_handler.rb', line 5

def get(id, query_params: nil)
  response = request("#{self.class::PATH}/#{id}", query_params: query_params, host_type: :netsuite_host)
  get_response_handler(response)
end

#query(query) ⇒ Object



25
26
27
28
# File 'lib/netsuite_api/concerns/request_handler.rb', line 25

def query(query)
  response = request("#{self.class::PATH}", query_params: query, host_type: :netsuite_host)
  get_response_handler(response)
end

#update(id, body, query_params: nil) ⇒ Object



15
16
17
18
# File 'lib/netsuite_api/concerns/request_handler.rb', line 15

def update(id, body, query_params: nil)
  response = request("#{self.class::PATH}/#{id}", body: body, method: :patch, host_type: :netsuite_host)
  post_and_patch_response_handler(response)
end