Class: Quickeebooks::Windows::Service::Employee

Inherits:
ServiceBase
  • Object
show all
Defined in:
lib/quickeebooks/windows/service/employee.rb

Constant Summary

Constants inherited from ServiceBase

ServiceBase::XML_NS

Instance Attribute Summary

Attributes inherited from ServiceBase

#base_uri, #last_response_body, #last_response_xml, #oauth, #realm_id

Instance Method Summary collapse

Methods inherited from ServiceBase

#access_token=, #enforce_filter_order, #initialize, #url_for_base, #url_for_resource

Methods included from Logging

#log

Constructor Details

This class inherits a constructor from Quickeebooks::Windows::Service::ServiceBase

Instance Method Details

#create(employee) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/quickeebooks/windows/service/employee.rb', line 12

def create(employee)
  raise InvalidModelException unless employee.valid_for_create?

  # XML is a wrapped 'object' where the type is specified as an attribute
  #    <Object xsi:type="Invoice">
  xml_node = employee.to_xml(:name => 'Object')
  xml_node.set_attribute('xsi:type', 'Employee')
  xml = Quickeebooks::Shared::Service::OperationNode.new.add do |content|
    content << "<ExternalRealmId>#{self.realm_id}</ExternalRealmId>#{xml_node}"
  end
  perform_write(Quickeebooks::Windows::Model::Employee, xml)
end

#list(filters = [], page = 1, per_page = 20, sort = nil, options = {}) ⇒ Object



8
9
10
# File 'lib/quickeebooks/windows/service/employee.rb', line 8

def list(filters = [], page = 1, per_page = 20, sort = nil, options = {})
  fetch_collection(Quickeebooks::Windows::Model::Employee, nil, filters, page, per_page, sort, options)
end