apralib 0.0.2 → 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
- SHA1:
3
- metadata.gz: 224a37c92a5d6d226dc47de0b91306afea784f2b
4
- data.tar.gz: d51148502133e9c5dd52597c85ef56482076f85f
2
+ SHA256:
3
+ metadata.gz: c82771315862534107fdf877581a8acc4b834d57b3b162b4248784fc0476ea8f
4
+ data.tar.gz: 63cbc93ef71202087e605373b254da69cfee60bf072f3143e5c47f6f4ea43018
5
5
  SHA512:
6
- metadata.gz: 9fbad13674a88ea3fe41e72b247a2d92cf5647b3714220fdffa81d36d9977865f3dabbf7cfcc78d8fc55932e690812d360fb226ec6535b7a56240758cc1639d0
7
- data.tar.gz: 873b94bd5cc2a74753a97f84ae5f8d51dbc48f1bca7aed0ce83e5c806e4efe71d182ceaf223e392574e697e92f5ccc54e6f9b6ffb1710547c2e5287069743202
6
+ metadata.gz: b3b976bd086d348a024924fef2c9846910a842f1c39cd0892ec3a0d84bf89fd1f381d0b850b89119b106f138a4a437540e2a689be5c74491b97d41859b5df248
7
+ data.tar.gz: d54037f2eaf19b88077336da847dd3e7331fdf201be8f9a5ff841b434d95b198baf77cfef29f503248141cc436fea4101235304e309da552b09fc5fa04177fd0
@@ -0,0 +1,3 @@
1
+ Metrics/BlockLength:
2
+ Exclude:
3
+ - spec/**/*.rb
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.3
4
- - 1.9.3
5
- env:
6
- global:
7
- - secure: XQ58eL4HELhYo0x1RgzyLkAF+XCBzTZLe3NIs4qsc4wIbeIUWVxb6chm/8ikbQn8ndk06EsJrZV/HC08EebUtgb1WTGeaEhyJGdyTVThO2dbLc+wKdrrGcmxiZEd1N6pg0G+4l8QsvMCTWJts6ZhrvVtmle6izGPfF467hLWIjM=
8
- - secure: FY5lZvsTluLglsk0j4c4rPXj0BqN80PVUzCLwFtBzhZJ/Dic8c6IGGDy91RQPoR11bcsqQgUhEOeTh0LEjmuGijZ1WIm0/0PynLZe2rxM76OA/ph5KKmYIgi5OLEkWJ8mQRLSeOqpw2BeaqW35MfhX6uItcJbEztiSgVkx01Y4g=
3
+ - 2.7.2
4
+ - 2.4.0
5
+ deploy:
6
+ provider: rubygems
7
+ edge: true
8
+
@@ -17,10 +17,12 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
+ spec.required_ruby_version = '>= 2.4.0'
20
21
 
21
- spec.add_development_dependency 'bundler', '~> 1.3'
22
- spec.add_development_dependency 'rake'
23
- spec.add_development_dependency 'rspec', '~> 3.1.0'
22
+ spec.add_development_dependency 'bundler', '~> 2.1'
23
+ spec.add_development_dependency 'rake', '~> 13.0.0'
24
+ spec.add_development_dependency 'rspec', '~> 3.10.0'
24
25
  spec.add_development_dependency 'yard'
25
- spec.add_dependency 'savon', '~> 2.3.0'
26
+ spec.add_dependency 'savon', '~> 2.12.0'
27
+
26
28
  end
@@ -6,10 +6,12 @@ module ApraService
6
6
 
7
7
  class Client
8
8
 
9
- def initialize(username, password)
9
+ def initialize(username, password, proxy = nil)
10
+
10
11
  @client = Savon.client(wsdl: 'https://palvelu.mela.fi/Apurahailmoitukset/ws/apurahanSyottoWS?wsdl',
11
12
  wsse_auth: [username, password],
12
- endpoint: 'https://palvelu.mela.fi/Apurahailmoitukset/ws/apurahanSyottoWS')
13
+ endpoint: 'https://palvelu.mela.fi/Apurahailmoitukset/ws/apurahanSyottoWS',
14
+ proxy: proxy)
13
15
  end
14
16
 
15
17
  def send_notifications(notifications)
@@ -2,8 +2,8 @@ module ApraService
2
2
 
3
3
  class Grantee
4
4
 
5
- SSN_REGEX = /(\d{6})([-+A])(\d{3})([0-9ABCDEFHJKLMNPRSTUVWXY])/
6
- CHECK_DIGITS = %w(0 1 2 3 4 5 6 7 8 9 A B C D E F H J K L M N P R S T U V X Y)
5
+ SSN_REGEX = /(\d{6})([-+A])(\d{3})([0-9ABCDEFHJKLMNPRSTUVWXY])/.freeze
6
+ CHECK_DIGITS = %w[0 1 2 3 4 5 6 7 8 9 A B C D E F H J K L M N P R S T U V W X Y].freeze
7
7
 
8
8
  attr_accessor :first_names, :last_name, :ssn, :address, :zip
9
9
 
@@ -26,16 +26,20 @@ module ApraService
26
26
  grantee.address = hash[:apurahansaajanosoite]
27
27
  grantee.zip = hash[:apurahansaajanpostinumero]
28
28
  grantee.first_names = [hash[:etunimi1]]
29
- grantee.first_name << hash[:etunimi2] if hash[:etunimi2]
30
- grantee.first_name << hash[:etunimi3] if hash[:etunimi3]
29
+ grantee.first_names << hash[:etunimi2] if hash[:etunimi2]
30
+ grantee.first_names << hash[:etunimi3] if hash[:etunimi3]
31
31
  grantee.ssn = hash[:henkilotunnus]
32
32
  grantee.last_name = hash[:sukunimi]
33
33
  grantee
34
34
  end
35
35
 
36
36
  def ssn=(ssn)
37
- Grantee.verify_ssn!(ssn)
38
- self.instance_variable_set('@ssn', ssn)
37
+ if ssn
38
+ Grantee.verify_ssn!(ssn.upcase)
39
+ self.instance_variable_set('@ssn', ssn.upcase)
40
+ else
41
+ self.instance_variable_set('@ssn', nil)
42
+ end
39
43
  end
40
44
 
41
45
  def self.verify_ssn!(ssn)
@@ -1,3 +1,3 @@
1
1
  module Apralib
2
- VERSION = '0.0.2'
2
+ VERSION = '0.1.1'.freeze
3
3
  end
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'apralib'
3
+ require 'securerandom'
3
4
 
4
5
  module ApraService
5
6
 
@@ -9,10 +10,11 @@ module ApraService
9
10
  def get_client
10
11
  credentials = {}
11
12
  credentials_file = File.join(File.dirname(__FILE__), 'apra_credentials.yml')
12
- credentials = YAML.load(File.read(credentials_file)) if File.exists?(credentials_file)
13
+ credentials = YAML.load(File.read(credentials_file)) if File.exist?(credentials_file)
13
14
  user = credentials['user'] || ENV['APRA_USER']
14
15
  password = credentials['password'] || ENV['APRA_PASSWORD']
15
- Client.new(user, password)
16
+ proxy = credentials['proxy'] || ENV['PROXY_URL']
17
+ Client.new(user, password, proxy)
16
18
  end
17
19
 
18
20
 
@@ -20,7 +22,7 @@ module ApraService
20
22
 
21
23
  it 'should create a valid object' do
22
24
 
23
- service = Client.new('user','password')
25
+ service = Client.new('user', 'password')
24
26
  expect(service).not_to be_nil
25
27
 
26
28
  end
@@ -22,6 +22,28 @@ module ApraService
22
22
 
23
23
  end
24
24
 
25
+ describe 'ssn=' do
26
+
27
+ it 'should convert the code to uppercase' do
28
+
29
+ grantee = Grantee.new
30
+ grantee.ssn = '111111-111c'
31
+ expect(grantee.ssn).to eq('111111-111C')
32
+
33
+ end
34
+
35
+ it 'should set the value to nil when passed a nil value' do
36
+
37
+ grantee = Grantee.new
38
+ grantee.ssn = '111111-111C'
39
+ grantee.ssn = nil
40
+ expect(grantee.ssn).to be_nil
41
+
42
+ end
43
+
44
+
45
+ end
46
+
25
47
  end
26
48
 
27
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apralib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Sandrini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-08 00:00:00.000000000 Z
11
+ date: 2020-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '2.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 13.0.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 13.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.1.0
47
+ version: 3.10.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.1.0
54
+ version: 3.10.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yard
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.3.0
75
+ version: 2.12.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 2.3.0
82
+ version: 2.12.0
83
83
  description: A Ruby client for the Apra Service
84
84
  email:
85
85
  - nessche@gmail.com
@@ -88,6 +88,7 @@ extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
+ - ".rubocop.yml"
91
92
  - ".travis.yml"
92
93
  - Gemfile
93
94
  - LICENSE.txt
@@ -116,15 +117,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
117
  requirements:
117
118
  - - ">="
118
119
  - !ruby/object:Gem::Version
119
- version: '0'
120
+ version: 2.4.0
120
121
  required_rubygems_version: !ruby/object:Gem::Requirement
121
122
  requirements:
122
123
  - - ">="
123
124
  - !ruby/object:Gem::Version
124
125
  version: '0'
125
126
  requirements: []
126
- rubyforge_project:
127
- rubygems_version: 2.2.2
127
+ rubygems_version: 3.0.8
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: A Ruby library to submit documents to the Apra Service run by Maatalousyrittäjien
@@ -133,4 +133,3 @@ test_files:
133
133
  - spec/lib/apra_service_spec.rb
134
134
  - spec/lib/grantee_spec.rb
135
135
  - spec/spec_helper.rb
136
- has_rdoc: