fastapi 0.1.24 → 0.1.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fastapi.rb +53 -55
  3. metadata +104 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 865a2af8b7cb9eaa5b07b197e8488d52b59b7301
4
- data.tar.gz: 7837dbace0c099fb7a1b09e33702f0fdc53bacc0
3
+ metadata.gz: a6257aad18a7f5ccf31fd70bcb267a3976b83518
4
+ data.tar.gz: 81a7955417c82b41deafc611138a1fe606d20d4f
5
5
  SHA512:
6
- metadata.gz: 0ca511a49d7786c24e8d8fa875dd1faac08f10409761da15e75dd18257e04818e0542316aa14ff7232a5667a1d9ab5c7265d366585c5111a9e61a9c0f07318e0
7
- data.tar.gz: 2c56f860cfcdc05baaa1468d21064d3efa720999c5a051b98ef02fd0bd2b806fe76781d308525c4083b57a9c74a749edbd6e6881174e966c5dd143a13077390b
6
+ metadata.gz: db70059eb226331aa57f6964612d7fde14e64b47671950882c2408ec1c0730740fa7fc60540f832ec713a449547727446fc715d32662bfc98f895b3f1f09681c
7
+ data.tar.gz: d0a9bfffd1eed2b65288bcaad6eb01331e573df1932923e75d0b9d6d679c19b70ce5a065f852291c50b1fce4132259bab8e488a3aa921802ed635f54421a22d8
data/lib/fastapi.rb CHANGED
@@ -492,6 +492,8 @@ class FastAPI
492
492
  elsif c == ','
493
493
 
494
494
  i = i + 1
495
+ cur_row[fields[entry_index]] = nil
496
+ entry_index = entry_index + 1
495
497
 
496
498
  else
497
499
 
@@ -802,85 +804,81 @@ class FastAPI
802
804
 
803
805
  end
804
806
 
805
- if model.nil?
806
-
807
- if self_obj.reflect_on_all_associations(:has_many).map(&:name).include? key
807
+ if model.nil? and (self_obj.reflect_on_all_associations(:has_many).map(&:name).include? key)
808
808
 
809
- filter_result = parse_filters(value, safe, field.singularize.classify.constantize)
810
- # puts filter_result
811
- filter_has_many[key] = filter_result[:main]
812
- order_has_many[key] = filter_result[:main_order]
809
+ filter_result = parse_filters(value, safe, field.singularize.classify.constantize)
810
+ # puts filter_result
811
+ filter_has_many[key] = filter_result[:main]
812
+ order_has_many[key] = filter_result[:main_order]
813
813
 
814
- elsif self_obj.reflect_on_all_associations(:belongs_to).map(&:name).include? key or
815
- self_obj.reflect_on_all_associations(:has_one).map(&:name).include? key
814
+ elsif model.nil? and (self_obj.reflect_on_all_associations(:belongs_to).map(&:name).include? key or
815
+ self_obj.reflect_on_all_associations(:has_one).map(&:name).include? key)
816
816
 
817
- filter_result = parse_filters(value, safe, field.singularize.classify.constantize)
818
- # puts filter_result
819
- filter_belongs_to[key] = filter_result[:main]
820
- order_belongs_to[key] = filter_result[:main_order]
817
+ filter_result = parse_filters(value, safe, field.singularize.classify.constantize)
818
+ # puts filter_result
819
+ filter_belongs_to[key] = filter_result[:main]
820
+ order_belongs_to[key] = filter_result[:main_order]
821
821
 
822
- elsif self_obj.column_names.include? field
822
+ elsif self_obj.column_names.include? field
823
823
 
824
- base_field = self_string_table + '.' + field
825
- field_string = base_field
826
- is_array = false
824
+ base_field = self_string_table + '.' + field
825
+ field_string = base_field
826
+ is_array = false
827
827
 
828
- if self_obj.columns_hash[field].respond_to?('array') and self_obj.columns_hash[field].array == true
828
+ if self_obj.columns_hash[field].respond_to?('array') and self_obj.columns_hash[field].array == true
829
829
 
830
- field_string = 'ANY(' + field_string + ')'
831
- is_array = true
832
-
833
- end
830
+ field_string = 'ANY(' + field_string + ')'
831
+ is_array = true
834
832
 
835
- if self_obj.columns_hash[field].type == :boolean
833
+ end
836
834
 
837
- if !!value != value
835
+ if self_obj.columns_hash[field].type == :boolean
838
836
 
839
- bool_lookup = {
840
- 't' => true,
841
- 'f' => false,
842
- 'true' => true,
843
- 'false' => false
844
- }
837
+ if !!value != value
845
838
 
846
- value = value.to_s.downcase
839
+ bool_lookup = {
840
+ 't' => true,
841
+ 'f' => false,
842
+ 'true' => true,
843
+ 'false' => false
844
+ }
847
845
 
848
- if bool_lookup.has_key? value
849
- value = bool_lookup[value]
850
- else
851
- value = true
852
- end
846
+ value = value.to_s.downcase
853
847
 
848
+ if bool_lookup.has_key? value
849
+ value = bool_lookup[value]
850
+ else
851
+ value = true
854
852
  end
855
853
 
856
- if !!value == value
857
-
858
- if comparator == 'is'
859
- filter_array << value.to_s.upcase + ' = ' + field_string
860
- elsif comparator == 'not'
861
- filter_array << 'NOT ' + value.to_s.upcase + ' = ' + field_string
862
- end
863
-
864
- end
854
+ end
865
855
 
866
- elsif value == nil and comparator != 'is_null' and comparator != 'not_null'
856
+ if !!value == value
867
857
 
868
858
  if comparator == 'is'
869
- filter_array << 'NULL = ' + field_string
859
+ filter_array << value.to_s.upcase + ' = ' + field_string
870
860
  elsif comparator == 'not'
871
- filter_array << 'NOT NULL = ' + field_string
861
+ filter_array << 'NOT ' + value.to_s.upcase + ' = ' + field_string
872
862
  end
873
863
 
874
- elsif value.is_a? Range and comparator == 'is'
864
+ end
875
865
 
876
- filter_array << ActiveRecord::Base.connection.quote(value.first.to_s) + ' <= ' + field_string
877
- filter_array << ActiveRecord::Base.connection.quote(value.last.to_s) + ' >= ' + field_string
866
+ elsif value == nil and comparator != 'is_null' and comparator != 'not_null'
878
867
 
879
- else
868
+ if comparator == 'is'
869
+ filter_array << 'NULL = ' + field_string
870
+ elsif comparator == 'not'
871
+ filter_array << 'NOT NULL = ' + field_string
872
+ end
880
873
 
881
- filter_array << api_comparison(comparator, value, base_field, self_obj.columns_hash[field].type, is_array)
874
+ elsif value.is_a? Range and comparator == 'is'
882
875
 
883
- end
876
+ filter_array << ActiveRecord::Base.connection.quote(value.first.to_s) + ' <= ' + field_string
877
+ filter_array << ActiveRecord::Base.connection.quote(value.last.to_s) + ' >= ' + field_string
878
+
879
+ else
880
+
881
+ filter_array << api_comparison(comparator, value, base_field, self_obj.columns_hash[field].type, is_array)
884
882
 
885
883
  end
886
884
 
@@ -1032,7 +1030,7 @@ class FastAPI
1032
1030
  if not filters[:has_many_order][model_symbol].nil?
1033
1031
  has_many_order = 'ORDER BY ' + filters[:has_many_order][model_symbol]
1034
1032
  end
1035
-
1033
+
1036
1034
  end
1037
1035
 
1038
1036
  field_list << [
metadata CHANGED
@@ -1,15 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Horwood
8
+ - Trevor Strieber
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-03-19 00:00:00.000000000 Z
12
+ date: 2015-04-02 00:00:00.000000000 Z
12
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activerecord
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 3.2.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 3.2.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: activesupport
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 3.2.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 3.2.0
13
42
  - !ruby/object:Gem::Dependency
14
43
  name: oj
15
44
  requirement: !ruby/object:Gem::Requirement
@@ -25,19 +54,89 @@ dependencies:
25
54
  - !ruby/object:Gem::Version
26
55
  version: 2.9.9
27
56
  - !ruby/object:Gem::Dependency
28
- name: rails
57
+ name: pg
29
58
  requirement: !ruby/object:Gem::Requirement
30
59
  requirements:
31
60
  - - ">="
32
61
  - !ruby/object:Gem::Version
33
- version: 3.2.0
62
+ version: 0.18.1
34
63
  type: :runtime
35
64
  prerelease: false
36
65
  version_requirements: !ruby/object:Gem::Requirement
37
66
  requirements:
38
67
  - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 0.18.1
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '10.0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '10.0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: bundler
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '1.3'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '1.3'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rspec
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: 3.2.0
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
39
110
  - !ruby/object:Gem::Version
40
111
  version: 3.2.0
112
+ - !ruby/object:Gem::Dependency
113
+ name: factory_girl
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '4.0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '4.0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: database_cleaner
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: 1.4.1
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: 1.4.1
41
140
  description: Easily create robust, standardized API endpoints using lightning-fast
42
141
  database queries
43
142
  email: keithwhor@gmail.com
@@ -67,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
166
  version: '0'
68
167
  requirements: []
69
168
  rubyforge_project:
70
- rubygems_version: 2.2.2
169
+ rubygems_version: 2.4.6
71
170
  signing_key:
72
171
  specification_version: 4
73
172
  summary: Easily create robust, standardized API endpoints using lightning-fast database