fastapi 0.1.7 → 0.1.8

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 +7 -16
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3eab51823b0d3829f997cadbacb612eb6702eaae
4
- data.tar.gz: 39dff598e51d82b0f6636175022b64abeb61102a
3
+ metadata.gz: 37056922d778444be79f5020161722430529e5e4
4
+ data.tar.gz: 033dd3d2f7ea79de5839d6b8c9277ba008ede364
5
5
  SHA512:
6
- metadata.gz: c323ec43ee5b54a50bd909bd0fde2460f92bfe9b467ecabe2e85eb529f54fa65d2797a3ab90081e8055be2fe470db3fb3650932e6411ef14948d32025a1adaa7
7
- data.tar.gz: 0ba48b30c2e5c04a9cd54110b6aa4293fc6e27bf4abf76ed94b8e306dd60f9c5c56a8ba9cb19ab971b42202ae2a1f8aef233400979d61ffa1ea8a038513e506b
6
+ metadata.gz: b2a4fc990c58642ea548974913ab5ff81d41f677d0a403f7e2be491d46a784410ae1e071f9a4639185165683f4542611e287667e6db69052e27e568f96a5d54a
7
+ data.tar.gz: 366e4b9120db2ffc0edb029a7a7236981ab171f8d178728148a21b7cd219d3f5d64670fc4d5ba16e42d8ffd1ec5cc83a272de262f34dad4a143df42f1e5a6e7f
data/lib/fastapi.rb CHANGED
@@ -498,6 +498,7 @@ class FastAPI
498
498
  self_obj = model.nil? ? @model : model
499
499
  self_string_table = model.nil? ? @model.to_s.tableize : '__' + model.to_s.tableize
500
500
 
501
+ filters = filters.clone()
501
502
  # if we're at the top level...
502
503
  if model.nil?
503
504
 
@@ -511,18 +512,7 @@ class FastAPI
511
512
  end
512
513
  end
513
514
 
514
- all_filters = {}
515
-
516
- @model.fastapi_filters.each do |key, value|
517
- if value.is_a? Hash
518
- copy = {}
519
- value.each do |key, value|
520
- copy[key] = value
521
- end
522
- value = copy
523
- end
524
- all_filters[key] = value
525
- end
515
+ all_filters = @model.fastapi_filters.clone()
526
516
 
527
517
  filters.each do |field, value|
528
518
  all_filters[field.to_sym] = value
@@ -533,7 +523,7 @@ class FastAPI
533
523
  end
534
524
 
535
525
  if not filters.has_key? :__order
536
- filters[:__order] = [:created_at, 'DESC']
526
+ filters[:__order] = [:created_at, :DESC]
537
527
  end
538
528
 
539
529
 
@@ -566,7 +556,7 @@ class FastAPI
566
556
 
567
557
  if key == :__order
568
558
 
569
- order = value
559
+ order = value.clone()
570
560
 
571
561
  if order.is_a? String
572
562
  order = order.split(',')
@@ -574,6 +564,7 @@ class FastAPI
574
564
  order << 'ASC'
575
565
  end
576
566
  elsif order.is_a? Array
567
+ order = order.map { |v| v.to_s }
577
568
  while order.size < 2
578
569
  order << ''
579
570
  end
@@ -581,10 +572,10 @@ class FastAPI
581
572
  order = ['', '']
582
573
  end
583
574
 
584
- if not self_obj.column_names.include? order[0].to_s
575
+ if not self_obj.column_names.include? order[0]
585
576
  order = nil
586
577
  else
587
- order[0] = self_string_table + '.' + order[0].to_s
578
+ order[0] = self_string_table + '.' + order[0]
588
579
  if not ['ASC', 'DESC'].include? order[1]
589
580
  order[1] = 'ASC'
590
581
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Horwood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-28 00:00:00.000000000 Z
11
+ date: 2014-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj