Class: Quickbooks::Service::PaymentMethod

Inherits:
BaseService
  • Object
show all
Defined in:
lib/quickbooks/service/payment_method.rb

Constant Summary

Constants inherited from BaseService

BaseService::BASE_DOMAIN, BaseService::HTTP_ACCEPT, BaseService::HTTP_ACCEPT_ENCODING, BaseService::HTTP_CONTENT_TYPE, BaseService::SANDBOX_DOMAIN, BaseService::XML_NS

Instance Attribute Summary

Attributes inherited from BaseService

#base_uri, #company_id, #last_response_body, #last_response_xml, #oauth

Instance Method Summary collapse

Methods inherited from BaseService

#access_token=, #default_model_query, #initialize, #is_json?, #is_pdf?, #realm_id=, #url_for_base, #url_for_query, #url_for_resource

Methods included from ServiceCrud

#all, #create, #delete_by_query_string, #fetch_by_id, #find_by, #query, #query_in_batches

Methods included from Util::Logging

#log, #log_xml

Constructor Details

This class inherits a constructor from Quickbooks::Service::BaseService

Instance Method Details

#delete(department) ⇒ Object



18
19
20
21
# File 'lib/quickbooks/service/payment_method.rb', line 18

def delete(department)
  department.active = false
  update(department, :sparse => false)
end

#fetch_by_name(name) ⇒ Object



5
6
7
# File 'lib/quickbooks/service/payment_method.rb', line 5

def fetch_by_name(name)
  self.query(search_name_query(name)).entries.first
end

#search_name_query(name) ⇒ Object



9
10
11
# File 'lib/quickbooks/service/payment_method.rb', line 9

def search_name_query(name)
  "SELECT * FROM PaymentMethod WHERE Name = '#{name}'"
end

#update(entity, options = {}) ⇒ Object



13
14
15
16
# File 'lib/quickbooks/service/payment_method.rb', line 13

def update(entity, options = {})
  raise Quickbooks::InvalidModelException.new('Payment Method sparse update is not supported by Intuit at this time') if options[:sparse] && options[:sparse] == true
  super(entity, options)
end