15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/intacctrb/contact.rb', line 15
def get_by_name(options = {})
options[:fields] = [
:contactid,
:contactname
] if options[:fields].nil?
response = send_xml('get') do |xml|
xml.function(controlid: "f4") {
xml.readByName {
xml.object 'contact'
xml.keys object.try(:name) || options[:name]
xml.fields '*'
}
}
end
if successful?
data = OpenStruct.new({
id: response.at("//contact/RECORDNO").try(:content),
name: response.at("//contact/CONTACTNAME").try(:content)
})
end
return_result(response, data)
end
|