advantage_quickbase 0.8.6 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/quickbase.rb +11 -3
  2. metadata +2 -2
data/lib/quickbase.rb CHANGED
@@ -70,7 +70,9 @@ module AdvantageQuickbase
70
70
 
71
71
  def do_query( db_id, options )
72
72
  # Define the query format
73
- if !options[ :fmt ]
73
+ if options.has_key?( :fmt ) && options[:fmt].to_s.strip.empty?
74
+ options.delete :fmt
75
+ else
74
76
  options[ :fmt ] = 'structured'
75
77
  end
76
78
 
@@ -88,8 +90,14 @@ module AdvantageQuickbase
88
90
  return_json = []
89
91
  result.css( 'record' ).each do |record|
90
92
  json_record = {}
91
- record.css( 'f' ).each do |field|
92
- json_record[ field['id'] ] = field.text
93
+ if options.has_key? :fmt
94
+ record.css( 'f' ).each do |field|
95
+ json_record[ field['id'] ] = field.text
96
+ end
97
+ else
98
+ record.element_children.each do |field|
99
+ json_record[ field.node_name ] = field.text
100
+ end
93
101
  end
94
102
 
95
103
  return_json << json_record
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: advantage_quickbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-20 00:00:00.000000000 Z
12
+ date: 2015-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri