roqua-core-api 0.0.38 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfa7b18ae2ac2f8b75b200310a7d51922fad8a58
4
- data.tar.gz: d8863c44b0107988d1795588bfedd05415c53d86
3
+ metadata.gz: 8cd38de53cdc42dbe949e24daf7c94b16cd67cb1
4
+ data.tar.gz: e235d2508f48d15f974e0ca4fedd4c87727a631f
5
5
  SHA512:
6
- metadata.gz: bd2a9e447bc550397b09ef3de30e754f41b27f959441ec5a398a1cb950436a3dfaca8ca019424c73513cb1215d7532104d9eb9957591a76752cd92aee6348b22
7
- data.tar.gz: 4149166bc8a35b4a274b7d553b039e1ce0fdabe1fcc1dbe735ab69cb3bc23dd7c35f85079f49d5f5e7aadebabbaf838ea5baee61218971adee942e2724ebb027
6
+ metadata.gz: e460c86c6f6513d47983a8241b656c09da14f1a0f67de636ccab77eab448761e2ae69f58c0b46aaa453eab435d9e39ab17e2b284e73b83e3b5d52d8f295104f2
7
+ data.tar.gz: cc60593fd46d57fcf6904d534e9f960e413d5d56b434e5f7c09f8a889a7e6e67bd8a8a043477c3dc6e95bbe9c4ad5c9694721b4adfc6dbf7568a604f70053d43
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.0.39
2
+
3
+ Handle empty rails date params
4
+
1
5
  ### 0.0.37
2
6
 
3
7
  Handling new 422 json format in addition to old (temporary hack)
@@ -28,7 +28,7 @@ class Roqua::CoreApi::Models::ActiveVirtus
28
28
  def dates_from_xi(params)
29
29
  return unless params
30
30
  dates_to_change = self.class.attribute_set.select do |a|
31
- a.type.primitive <= Date && params.key?("#{a.name}(1i)")
31
+ a.type.primitive <= Date && params["#{a.name}(1i)"].present?
32
32
  end
33
33
  dates_to_change.each do |a|
34
34
  date_from_xi(a.name, params)
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module CoreApi
3
- VERSION = '0.0.38'
3
+ VERSION = '0.0.39'
4
4
  end
5
5
  end
@@ -15,6 +15,7 @@ module Roqua
15
15
  it 'can be set by date(i1) params' do
16
16
  subject.attributes = { 'date(1i)' => '1999', 'date(2i)' => '12', 'date(3i)' => '8'}
17
17
  expect(subject.date).to eq Date.new(1999, 12, 8)
18
+ expect(subject.errors).to be_empty
18
19
  end
19
20
  it 'sets an error if the date is invalid' do
20
21
  subject.attributes = { 'date(1i)' => '1999', 'date(2i)' => '12', 'date(3i)' => '32'}
@@ -23,6 +24,17 @@ module Roqua
23
24
  it 'can create new with date(i1) params' do
24
25
  foo = Foo.new('date(1i)' => '1999', 'date(2i)' => '12', 'date(3i)' => '8')
25
26
  expect(foo.date).to eq Date.new(1999, 12, 8)
27
+ expect(foo.errors).to be_empty
28
+ end
29
+ it 'allows for a date not to be set' do
30
+ foo = Foo.new
31
+ expect(foo.date).to be_nil
32
+ expect(foo.errors).to be_empty
33
+ end
34
+ it 'sets date to nil if date params are empty strings' do
35
+ foo = Foo.new('date(1i)' => '', 'date(2i)' => '', 'date(3i)' => '')
36
+ expect(foo.date).to be_nil
37
+ expect(foo.errors).to be_empty
26
38
  end
27
39
  end
28
40
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-core-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.38
4
+ version: 0.0.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-12 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  version: '0'
252
252
  requirements: []
253
253
  rubyforge_project:
254
- rubygems_version: 2.2.2
254
+ rubygems_version: 2.3.0
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: API wrapper gem around Core's API