Commit 40f47b36eab9ccf9bba900dc779bfb10b638e1bb
Committed by
GitHub
Merge pull request #6 from wildland/wip-combrw-refactor
COMBRW Update
Showing
2 changed files
with
8 additions
and
15 deletions
Show diff stats
lib/syspro/business_objects/combrw.rb
| ... | ... | @@ -9,14 +9,18 @@ module Syspro |
| 9 | 9 | include Syspro::ApiOperations::Query |
| 10 | 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 | 13 | :table_name, :title, :columns |
| 14 | 14 | |
| 15 | - def call(user_id) | |
| 15 | + def call(user_id, raw = false) | |
| 16 | 16 | xml_in = template.result(binding) |
| 17 | 17 | params = { 'UserId' => user_id, 'XmlIn' => xml_in } |
| 18 | 18 | resp = ComBrw.browse(params) |
| 19 | - parse_response(resp) | |
| 19 | + unless raw | |
| 20 | + parse_response(resp) | |
| 21 | + else | |
| 22 | + resp | |
| 23 | + end | |
| 20 | 24 | end |
| 21 | 25 | |
| 22 | 26 | def template | ... | ... |
lib/syspro/business_objects/schemas/combrw.xml.erb
| 1 | 1 | <?xml version="1.0" encoding="Windows-1252"?> |
| 2 | 2 | <Browse xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="COMBRW.XSD"> |
| 3 | 3 | <BrowseName><%= @browse_name %></BrowseName> |
| 4 | - <StartAtKey/> | |
| 4 | + <StartAtKey><%= @start_at_key %></StartAtKey> | |
| 5 | 5 | <StartCondition><%= @start_condition %></StartCondition> |
| 6 | 6 | <ReturnRows><%= @return_rows %></ReturnRows> |
| 7 | 7 | <% for @filter in @filters %> |
| ... | ... | @@ -10,16 +10,5 @@ |
| 10 | 10 | <ColumnFilterValue><%= @filter[:value] %></ColumnFilterValue> |
| 11 | 11 | </Filter> |
| 12 | 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 | 13 | </Browse> |
| 25 | 14 | ... | ... |