Commit 40f47b36eab9ccf9bba900dc779bfb10b638e1bb

Authored by Isaac Lewis
Committed by GitHub
2 parents c0b8af52 cdbe5509

Merge pull request #6 from wildland/wip-combrw-refactor

COMBRW Update
lib/syspro/business_objects/combrw.rb
@@ -9,14 +9,18 @@ module Syspro @@ -9,14 +9,18 @@ module Syspro
9 include Syspro::ApiOperations::Query 9 include Syspro::ApiOperations::Query
10 include Syspro::BusinessObjects::Parsers 10 include Syspro::BusinessObjects::Parsers
11 11
12 - attr_accessor :browse_name, :start_condition, :return_rows, :filters, 12 + attr_accessor :browse_name, :start_at_key, :start_condition, :return_rows, :filters,
13 :table_name, :title, :columns 13 :table_name, :title, :columns
14 14
15 - def call(user_id) 15 + def call(user_id, raw = false)
16 xml_in = template.result(binding) 16 xml_in = template.result(binding)
17 params = { 'UserId' => user_id, 'XmlIn' => xml_in } 17 params = { 'UserId' => user_id, 'XmlIn' => xml_in }
18 resp = ComBrw.browse(params) 18 resp = ComBrw.browse(params)
19 - parse_response(resp) 19 + unless raw
  20 + parse_response(resp)
  21 + else
  22 + resp
  23 + end
20 end 24 end
21 25
22 def template 26 def template
lib/syspro/business_objects/schemas/combrw.xml.erb
1 <?xml version="1.0" encoding="Windows-1252"?> 1 <?xml version="1.0" encoding="Windows-1252"?>
2 <Browse xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="COMBRW.XSD"> 2 <Browse xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="COMBRW.XSD">
3 <BrowseName><%= @browse_name %></BrowseName> 3 <BrowseName><%= @browse_name %></BrowseName>
4 - <StartAtKey/> 4 + <StartAtKey><%= @start_at_key %></StartAtKey>
5 <StartCondition><%= @start_condition %></StartCondition> 5 <StartCondition><%= @start_condition %></StartCondition>
6 <ReturnRows><%= @return_rows %></ReturnRows> 6 <ReturnRows><%= @return_rows %></ReturnRows>
7 <% for @filter in @filters %> 7 <% for @filter in @filters %>
@@ -10,16 +10,5 @@ @@ -10,16 +10,5 @@
10 <ColumnFilterValue><%= @filter[:value] %></ColumnFilterValue> 10 <ColumnFilterValue><%= @filter[:value] %></ColumnFilterValue>
11 </Filter> 11 </Filter>
12 <% end %> 12 <% end %>
13 - <BrowseDetails>  
14 - <TableName><%= @table_name %></TableName>  
15 - <Title><%= @title %></Title>  
16 - <% for @column in @columns %>  
17 - <Column>  
18 - <% unless @column[:name].nil? %><ColumnName><%= @column[:name] %></ColumnName><% end %>  
19 - <% unless @column[:description].nil? %><ColumnDescription><%= @column[:description] %></ColumnDescription><% end %>  
20 - <% unless @column[:key].nil? %><ColumnKey><%= @column[:key] %></ColumnKey><% end %>  
21 - </Column>  
22 - <% end %>  
23 - </BrowseDetails>  
24 </Browse> 13 </Browse>
25 14