wire_client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d23672dd2a990aa5ca2d19ce40540fbbe2f950cab218fc900542b33ef3e3ed8b
4
- data.tar.gz: 875b4cd7eec9f842c4f9839ad6d9e454006b4e73c4a5050fed7647a9cb9ac8b0
3
+ metadata.gz: 9d0c3b07727f98c5fa219f4261a801b45df93d96cfce09034966243a87add16c
4
+ data.tar.gz: 553cb015719f0a62fe215ec1dff8e3a4ce7c5e886408eb8b08da39e6254ddd43
5
5
  SHA512:
6
- metadata.gz: 9232a3b8bfb6ce923ceb8a089d2103aee42232ba88c9fe84f88f5b7e8dc13ffafcf15e36f2eb80672707aa380542e5ffbef78e373ef5a712cd3946a24aff1954
7
- data.tar.gz: 8347c0487adc4c0697e60432bd936d70c56fc6559a5e790fe429be0605cf42c1ba44af12420305dd77ffa3ac9ecbffc7a752568ecd18c211337eccaa9c0767b6
6
+ metadata.gz: b28851c9b4c88299144add8d775a945f017418b9ef00b1576cdd0589212baec4f41d221a44720a42bdb148dc4548bf8a0b19f79c657f6ab343e03bcbfff585ed
7
+ data.tar.gz: 38525913045b466925ac1ebb822f5fce70251d9352e0887c455935f4caaeca8a19bf7f2928c8188f3e8f6fd634dcdeaf9078a62619b04a32b81283a365bfeb9c
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ Rake::TestTask.new(:test) do |t|
15
15
  end
16
16
 
17
17
  desc 'Build the sequel-seed gem'
18
- task :build do |p|
18
+ task :build do
19
19
  sh %{#{FileUtils::RUBY} -S gem build #{GEM}.gemspec}
20
20
  end
21
21
 
data/lib/wire_client.rb CHANGED
@@ -33,4 +33,12 @@ module WireClient
33
33
  end
34
34
  )
35
35
  end
36
+
37
+ def self.today
38
+ if Time.zone.present?
39
+ Time.zone.now.to_date
40
+ else
41
+ Date.today
42
+ end
43
+ end
36
44
  end
@@ -8,7 +8,7 @@ module WireClient
8
8
  validates_inclusion_of :service_level, :in => SERVICE_LEVEL_TYPES
9
9
 
10
10
  validate do |t|
11
- t.validate_requested_date_after(Time.zone.now.to_date.next)
11
+ t.validate_requested_date_after(WireClient.today.next)
12
12
  end
13
13
 
14
14
  def initialize(attributes = {})
@@ -23,7 +23,7 @@ module WireClient
23
23
  validates_inclusion_of :service_level, :in => SERVICE_LEVEL_TYPES
24
24
 
25
25
  validate do |t|
26
- t.validate_requested_date_after(Time.zone.now.to_date.next)
26
+ t.validate_requested_date_after(WireClient.today.next)
27
27
  end
28
28
 
29
29
  validate do |t|
@@ -32,7 +32,7 @@ module WireClient
32
32
  end
33
33
 
34
34
  if t.mandate_date_of_signature.is_a?(Date)
35
- if t.mandate_date_of_signature > Time.zone.now.to_date
35
+ if t.mandate_date_of_signature > WireClient.today
36
36
  errors.add(:mandate_date_of_signature, 'is in the future')
37
37
  end
38
38
  else
@@ -3,8 +3,6 @@ module WireClient
3
3
  include ActiveModel::Validations
4
4
  extend Converter
5
5
 
6
- DEFAULT_REQUESTED_DATE = Time.zone.now.to_date.freeze
7
-
8
6
  attr_accessor :name,
9
7
  :iban,
10
8
  :bic,
@@ -53,7 +51,7 @@ module WireClient
53
51
  @country ||= 'US'
54
52
  @clear_system_code ||= 'USABA'
55
53
  @agent_name ||= 'NOTPROVIDED'
56
- @requested_date ||= DEFAULT_REQUESTED_DATE
54
+ @requested_date ||= default_requested_date
57
55
  @reference ||= 'NOTPROVIDED'
58
56
  @batch_booking = true if @batch_booking.nil?
59
57
  @service_priority ||= 'NORM'
@@ -72,10 +70,14 @@ module WireClient
72
70
 
73
71
  protected
74
72
 
73
+ def default_requested_date
74
+ WireClient.today.freeze
75
+ end
76
+
75
77
  def validate_requested_date_after(min_requested_date)
76
78
  return unless requested_date.is_a?(Date)
77
79
 
78
- if requested_date != DEFAULT_REQUESTED_DATE &&
80
+ if requested_date != default_requested_date &&
79
81
  requested_date < min_requested_date
80
82
  errors.add(
81
83
  :requested_date,
@@ -1,4 +1,4 @@
1
1
  module WireClient
2
2
  # Increment this when changes are published
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wire_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ewerton Carlos Assis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-02-28 00:00:00.000000000 Z
12
+ date: 2018-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ach_client