avetmiss_data 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: 0f3834ce1babd801e949e695a05356b2393fa15f
4
+ data.tar.gz: e1fc4c1ad81980b91fccb8e1beabab9d1b3ea40d
5
+ SHA512:
6
+ metadata.gz: feac21b56289f4d4a88e4e8a6bf5811ed33f068e1a5f148570375abfad1f09fc8548a31d8b94dd4ce3559cd5cf5ff9e3b3b99bab0a9497a525df8606f4a18562
7
+ data.tar.gz: 1242c21e6e4cfd6156c7e9c760afa302e8aab134d41ac5490ae3c4c3eb84966acefff0ba30145b0579816e206b31100a744e590f0d05680bcf73de41afccd745
@@ -0,0 +1,3 @@
1
+ /pkg/
2
+ *.gem
3
+ /coverage/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
@@ -0,0 +1,19 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.1
4
+ cache:
5
+ - bundler
6
+ - apt
7
+ branches:
8
+ only:
9
+ - master
10
+ - develop
11
+ notifications:
12
+ hipchat: 83906daf46b0ce558ce21f13353861@246078
13
+ on_success: always
14
+ on_failure: always
15
+ script:
16
+ - bundle exec rspec
17
+ addons:
18
+ code_climate:
19
+ repo_token: 2a61bdd24e056cb4b413988835cbaca74c293838117a21da8a6258b36ec485e9
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
@@ -0,0 +1,54 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ avetmiss_data (1.0.0)
5
+ activesupport (= 3.2.17)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (3.2.17)
11
+ i18n (~> 0.6, >= 0.6.4)
12
+ multi_json (~> 1.0)
13
+ byebug (2.7.0)
14
+ columnize (~> 0.3)
15
+ debugger-linecache (~> 1.2)
16
+ cane (2.6.1)
17
+ parallel
18
+ codeclimate-test-reporter (0.3.0)
19
+ simplecov (>= 0.7.1, < 1.0.0)
20
+ columnize (0.3.6)
21
+ debugger-linecache (1.2.0)
22
+ diff-lcs (1.2.5)
23
+ factory_girl (4.4.0)
24
+ activesupport (>= 3.0.0)
25
+ i18n (0.6.9)
26
+ multi_json (1.9.0)
27
+ parallel (0.9.2)
28
+ rake (10.1.1)
29
+ rspec (2.14.1)
30
+ rspec-core (~> 2.14.0)
31
+ rspec-expectations (~> 2.14.0)
32
+ rspec-mocks (~> 2.14.0)
33
+ rspec-core (2.14.8)
34
+ rspec-expectations (2.14.5)
35
+ diff-lcs (>= 1.1.3, < 2.0)
36
+ rspec-mocks (2.14.6)
37
+ simplecov (0.7.1)
38
+ multi_json (~> 1.0)
39
+ simplecov-html (~> 0.7.1)
40
+ simplecov-html (0.7.1)
41
+
42
+ PLATFORMS
43
+ ruby
44
+
45
+ DEPENDENCIES
46
+ avetmiss_data!
47
+ bundler (~> 1.0)
48
+ byebug (~> 2.7)
49
+ cane (~> 2.6)
50
+ codeclimate-test-reporter (~> 0.3)
51
+ factory_girl (~> 4.4)
52
+ rake (~> 10.1)
53
+ rspec (~> 2.14)
54
+ simplecov (~> 0.7.1)
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 JobReady Solutions
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ # AVETMISS Data
2
+
3
+ [![Build Status](https://magnum.travis-ci.com/jobready/avetmiss_data.png?token=rpAHEL3fvHDpfBeDNS3M&branch=develop)](https://magnum.travis-ci.com/jobready/avetmiss_data)
4
+ [![Code Climate](https://codeclimate.com/repos/53169ebae30ba0581c007800/badges/63459af2a47ba777d79f/gpa.png)](https://codeclimate.com/repos/53169ebae30ba0581c007800/feed)
5
+
6
+ This gem supports the parsing and unparsing of AVETMISS NAT data.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'avetmiss_data'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install avetmiss_data
21
+
22
+ ## Usage
23
+
24
+ package = Avetmiss::Package.new('package.zip')
25
+
26
+ ## Contributing
27
+
28
+ 1. Fork it ( http://github.com/jobready/avetmiss_data/fork )
29
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
30
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
31
+ 4. Push to the branch (`git push origin my-new-feature`)
32
+ 5. Create new Pull Request
33
+
@@ -0,0 +1,7 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new('spec')
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/avetmiss_data/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'avetmiss_data'
6
+ s.version = AvetmissData::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ['Brenton Fletcher', 'Jehanzeb Khan']
9
+ s.email = ['brentonf@jobready.com.au', 'jehanzebk@jobready.com.au']
10
+ s.homepage = 'http://github.com/jobready/avetmiss_data'
11
+ s.summary = 'Gem for parsing and building AVETMISS (NAT) Files'
12
+ s.description = 'Parsing and building AVETMISS files'
13
+ s.license = 'MIT'
14
+
15
+ s.required_rubygems_version = '>= 1.3.6'
16
+
17
+ s.add_development_dependency 'bundler', '~> 1.0'
18
+ s.add_development_dependency 'rspec', '~> 2.14'
19
+ s.add_development_dependency 'factory_girl', '~> 4.4'
20
+ s.add_development_dependency 'cane', '~> 2.6'
21
+ s.add_development_dependency 'simplecov', '~> 0.7'
22
+ s.add_development_dependency 'byebug', '~> 2.7'
23
+ s.add_development_dependency 'rake', '~> 10.1'
24
+ s.add_development_dependency 'codeclimate-test-reporter', '~> 0.3'
25
+ s.add_dependency 'activesupport', '3.2.17'
26
+
27
+ s.files = `git ls-files`.split("\n")
28
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
29
+ s.require_path = 'lib'
30
+ end
@@ -0,0 +1,16 @@
1
+ require 'active_support/all'
2
+
3
+ module AvetmissData
4
+ end
5
+
6
+ require 'avetmiss_data/base'
7
+ require 'avetmiss_data/achievement'
8
+ require 'avetmiss_data/rto'
9
+ require 'avetmiss_data/rto_delivery_location'
10
+ require 'avetmiss_data/course'
11
+ require 'avetmiss_data/unit_of_competency'
12
+ require 'avetmiss_data/client'
13
+ require 'avetmiss_data/client_postal_detail'
14
+ require 'avetmiss_data/disability'
15
+ require 'avetmiss_data/enrolment'
16
+ require 'avetmiss_data/qual_completion'
@@ -0,0 +1,8 @@
1
+ class AvetmissData::Achievement < AvetmissData::Base
2
+ self.file = 'NAT00100'
3
+ self.file_format = {
4
+ client_identifier: 0...10,
5
+ prior_education_achievement_identifier: 10...13,
6
+ extras: 13..-1
7
+ }
8
+ end
@@ -0,0 +1,26 @@
1
+ class AvetmissData::Base
2
+ class_attribute :file_format, :file
3
+
4
+ def file_format_hash
5
+ self.class.file_format
6
+ end
7
+
8
+ def self.parse(record)
9
+ Hash[file_format.map do |attr, range|
10
+ value = record[range].try(:strip)
11
+ [attr, value]
12
+ end]
13
+ end
14
+
15
+ def self.max_record
16
+ file_format.values.map { |(range, _)| range.last }.max
17
+ end
18
+
19
+ def self.to_record(values)
20
+ str = ' ' * max_record
21
+ file_format.each_pair do |attr, (range, _)|
22
+ str[range] = values[attr].to_s.ljust(range.last - range.first, ' ')
23
+ end
24
+ str
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ class AvetmissData::Client < AvetmissData::Base
2
+ self.file = 'NAT00080'
3
+ self.file_format = {
4
+ client_identifier: 0...10,
5
+ name_for_encryption: 10...70,
6
+ highest_school_level_completed: 70...72,
7
+ highest_school_level_completed_year: 72...76,
8
+ sex: 76...77,
9
+ date_of_birth: 77...85,
10
+ post_code: 85...89,
11
+ indigenous_status_identifier: 89...90,
12
+ main_language_not_english: 90...94,
13
+ labour_force_status_identifier: 94...96,
14
+ country_identifier: 96...100,
15
+ disability_flag: 100...101,
16
+ prior_education_achievement_flag: 101...102,
17
+ at_school_flag: 102...103,
18
+ english_proficiency_identifier: 103...104,
19
+ address_location: 104...154,
20
+ extras: 154..-1
21
+ }
22
+ end
@@ -0,0 +1,19 @@
1
+ class AvetmissData::ClientPostalDetail < AvetmissData::Base
2
+ self.file = 'NAT00085'
3
+ self.file_format = {
4
+ client_identifier: 0...10,
5
+ client_title: 10...14,
6
+ client_first_name: 14...54,
7
+ client_last_name: 54...94,
8
+ address_first_line: 94...144,
9
+ address_second_line: 144...194,
10
+ address_postal: 194...244,
11
+ post_code: 244...248,
12
+ state_identifier: 248...250,
13
+ telephone_home: 250...270,
14
+ telephone_work: 270...290,
15
+ telephone_mobile: 290...310,
16
+ email_address: 310...390,
17
+ extras: 390..-1
18
+ }
19
+ end
@@ -0,0 +1,14 @@
1
+ class AvetmissData::Course < AvetmissData::Base
2
+ self.file = 'NAT00030'
3
+ self.file_format = {
4
+ qualification_identifier: 0...10,
5
+ qualification_name: 10...110,
6
+ nominal_hours: 110...114,
7
+ qualification_recognition_identifier: 114...116,
8
+ qualification_education_level_identifier: 116...119,
9
+ qualification_education_field_identifier: 119...123,
10
+ anzsco_identifier: 123...129,
11
+ vet_flag: 129...130,
12
+ extras: 130..-1
13
+ }
14
+ end
@@ -0,0 +1,8 @@
1
+ class AvetmissData::Disability < AvetmissData::Base
2
+ self.file = 'NAT00090'
3
+ self.file_format = {
4
+ client_identifier: 0...10,
5
+ disability_type_identifier: 10...12,
6
+ extras: 12..-1
7
+ }
8
+ end
@@ -0,0 +1,24 @@
1
+ class AvetmissData::Enrolment < AvetmissData::Base
2
+
3
+ self.file = 'NAT00120'
4
+ self.file_format = {
5
+ delivery_location_identifier: 0...10,
6
+ client_identifier: 10...20,
7
+ unit_competency_identifier: 20...32,
8
+ qualification_identifier: 32...42,
9
+ enrolment_activity_start_date: 42...50,
10
+ enrolment_activity_end_date: 50...58,
11
+ delivery_mode_identifier: 58...60,
12
+ national_outcome_identifier: 60...62,
13
+ scheduled_hours: 62...66,
14
+ national_funding_source: 66...68,
15
+ commencing_course_identifier: 68...69,
16
+ new_apprenticeships_training_contract_identifier: 69...79,
17
+ new_apprenticeships_client_identifier: 79...89,
18
+ study_reason_identifier: 89...91,
19
+ vet_in_school_flag: 91...92,
20
+ training_organisation_outcome_identifier: 92...96,
21
+ state_training_authority_funding_source: 96...99,
22
+ extras: 99..-1
23
+ }
24
+ end
@@ -0,0 +1,12 @@
1
+ class AvetmissData::QualCompletion < AvetmissData::Base
2
+
3
+ self.file = 'NAT00130'
4
+ self.file_format = {
5
+ training_organisation_identifier: 0...10,
6
+ qualification_identifier: 10...20,
7
+ client_identifier: 20...30,
8
+ program_completed_year: 30...34,
9
+ qualification_issued_flag: 34...35,
10
+ extras: 35..-1
11
+ }
12
+ end
@@ -0,0 +1,14 @@
1
+ class AvetmissData::Rto < AvetmissData::Base
2
+ self.file = 'NAT00010'
3
+ self.file_format = {
4
+ training_organisation_identifier: 0...10,
5
+ training_organisation_name: 10...110,
6
+ training_organisation_type_identifier: 110...112,
7
+ address_first_line: 112...162,
8
+ address_second_line: 162...212,
9
+ address_location: 212...262,
10
+ post_code: 262...266,
11
+ state_identifier: 266...268,
12
+ extras: 268..-1
13
+ }
14
+ end
@@ -0,0 +1,13 @@
1
+ class AvetmissData::RtoDeliveryLocation < AvetmissData::Base
2
+ self.file = 'NAT00020'
3
+ self.file_format = {
4
+ training_organisation_identifier: 0...10,
5
+ training_organisation_delivery_location_identifier: 10...20,
6
+ training_organisation_delivery_location_name: 20...120,
7
+ post_code: 120...124,
8
+ state_identifier: 124...126,
9
+ address_location: 126...176,
10
+ country_identifier: 176...180,
11
+ extras: 180..-1
12
+ }
13
+ end
@@ -0,0 +1,12 @@
1
+ class AvetmissData::UnitOfCompetency < AvetmissData::Base
2
+ self.file = 'NAT00060'
3
+ self.file_format = {
4
+ unit_competency_flag: 0...1,
5
+ unit_competency_identifier: 1...13,
6
+ unit_competency_name: 13...113,
7
+ unit_competency_education_field_identifier: 113...119,
8
+ vet_flag: 119...120,
9
+ nominal_hours: 120...124,
10
+ extras: 124..-1
11
+ }
12
+ end
@@ -0,0 +1,3 @@
1
+ module AvetmissData
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe AvetmissData::Achievement do
4
+ context 'imports the NAT00100 file' do
5
+
6
+ context 'NAT File' do
7
+ specify { expect(AvetmissData::Achievement.file).not_to be_blank }
8
+ specify { expect(AvetmissData::Achievement.file).to eq('NAT00100') }
9
+ end
10
+
11
+ context 'NAT Record Parse' do
12
+ let!(:row) { '12345 008' }
13
+ subject { AvetmissData::Achievement.parse(row) }
14
+
15
+ specify { expect(subject).not_to be_blank }
16
+ specify { expect(subject[:client_identifier]).to eq('12345') }
17
+ specify { expect(subject[:prior_education_achievement_identifier]).to eq('008') }
18
+ specify { expect(subject[:extras]).to be_blank }
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,101 @@
1
+ require 'spec_helper'
2
+
3
+ describe AvetmissData::Base do
4
+ let!(:base) { build :base }
5
+
6
+ context '#file_format_hash' do
7
+ before { AvetmissData::Base.file_format = {} }
8
+ specify { expect(base.file_format_hash).not_to be_nil }
9
+ end
10
+
11
+ context 'reading/writing' do
12
+ before do
13
+ AvetmissData::Base.file_format = {
14
+ foo: 0...5,
15
+ bar: 5...10,
16
+ baz: 10..-1
17
+ }
18
+ end
19
+
20
+ context '.parse' do
21
+ specify do
22
+ expect(AvetmissData::Base.parse('12345abcdeLOL')).to eq(
23
+ foo: '12345',
24
+ bar: 'abcde',
25
+ baz: 'LOL'
26
+ )
27
+ end
28
+
29
+ specify do
30
+ expect(AvetmissData::Base.parse('1 3 ab LOL')).to eq(
31
+ foo: '1 3',
32
+ bar: 'ab',
33
+ baz: 'LOL'
34
+ )
35
+ end
36
+
37
+ specify do
38
+ expect(AvetmissData::Base.parse(' 23 5 deLOL')).to eq(
39
+ foo: '23 5',
40
+ bar: 'de',
41
+ baz: 'LOL'
42
+ )
43
+ end
44
+
45
+ specify do
46
+ expect(AvetmissData::Base.parse('12345abcde')).to eq(
47
+ foo: '12345',
48
+ bar: 'abcde',
49
+ baz: ''
50
+ )
51
+ end
52
+ end
53
+
54
+ context '.max_record' do
55
+ specify { expect(AvetmissData::Base.max_record).to eq(10) }
56
+ end
57
+
58
+ context '.to_record' do
59
+ specify do
60
+ expect(AvetmissData::Base.to_record(
61
+ foo: '12345',
62
+ bar: 'abcde',
63
+ baz: 'LOL'
64
+ )).to eq('12345abcdeLOL')
65
+ end
66
+
67
+ specify do
68
+ expect(AvetmissData::Base.to_record(
69
+ foo: '12 3 ',
70
+ bar: 'a de',
71
+ baz: 'L L'
72
+ )).to eq('12 3 a deL L')
73
+ end
74
+
75
+ specify do
76
+ expect(AvetmissData::Base.to_record(
77
+ foo: ' 345',
78
+ bar: ' c e',
79
+ baz: ' OL'
80
+ )).to eq(' 345 c e OL')
81
+ end
82
+
83
+ specify do
84
+ expect(AvetmissData::Base.to_record(
85
+ foo: '12345',
86
+ bar: 'abcde',
87
+ baz: 'LOL',
88
+ cool: 'bananas'
89
+ )).to eq('12345abcdeLOL')
90
+ end
91
+
92
+ specify do
93
+ expect(AvetmissData::Base.to_record(
94
+ foo: '12345',
95
+ baz: 'LOL'
96
+ )).to eq('12345 LOL')
97
+ end
98
+ end
99
+ end
100
+
101
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe AvetmissData::ClientPostalDetail do
4
+ context 'imports the NAT00085 file' do
5
+
6
+ context 'NAT File' do
7
+ specify { expect(AvetmissData::ClientPostalDetail.file).not_to be_blank }
8
+ specify { expect(AvetmissData::ClientPostalDetail.file).to eq('NAT00085') }
9
+ end
10
+
11
+ context 'NAT Record Parse' do
12
+ let!(:row) { '12345 Mr Mount Franklin Some Steet Aarons Pass 2850010312121231 0222222222 ritar@jobready.com.au ' }
13
+ subject { AvetmissData::ClientPostalDetail.parse(row) }
14
+
15
+ specify { expect(subject).not_to be_blank }
16
+ specify { expect(subject[:client_identifier]).to eq('12345') }
17
+ specify { expect(subject[:client_title]).to eq('Mr') }
18
+ specify { expect(subject[:client_first_name]).to eq('Mount') }
19
+ specify { expect(subject[:client_last_name]).to eq('Franklin') }
20
+ specify { expect(subject[:address_first_line]).to eq('Some Steet') }
21
+ specify { expect(subject[:address_second_line]).to be_blank }
22
+ specify { expect(subject[:address_postal]).to eq('Aarons Pass') }
23
+ specify { expect(subject[:post_code]).to eq('2850') }
24
+ specify { expect(subject[:state_identifier]).to eq('01') }
25
+ specify { expect(subject[:telephone_home]).to eq('0312121231') }
26
+ specify { expect(subject[:telephone_work]).to be_blank }
27
+ specify { expect(subject[:telephone_mobile]).to eq('0222222222') }
28
+ specify { expect(subject[:email_address]).to eq('ritar@jobready.com.au') }
29
+ specify { expect(subject[:extras]).to be_blank }
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe AvetmissData::Client do
4
+ context 'imports the NAT00010 file' do
5
+
6
+ context 'NAT File' do
7
+ specify { expect(AvetmissData::Client.file).not_to be_blank }
8
+ specify { expect(AvetmissData::Client.file).to eq('NAT00080') }
9
+ end
10
+
11
+ context 'NAT Record Parse' do
12
+ let!(:row) { '12345 Franklin, Mount 091990M02091964285021201030012YYY Aarons Pass ' }
13
+ subject { AvetmissData::Client.parse(row) }
14
+
15
+ specify { expect(subject).not_to be_blank }
16
+ specify { expect(subject[:client_identifier]).to eq('12345') }
17
+ specify { expect(subject[:name_for_encryption]).to eq('Franklin, Mount') }
18
+ specify { expect(subject[:highest_school_level_completed]).to eq('09') }
19
+ specify { expect(subject[:highest_school_level_completed_year]).to eq('1990') }
20
+ specify { expect(subject[:sex]).to eq('M') }
21
+ specify { expect(subject[:date_of_birth]).to eq('02091964') }
22
+ specify { expect(subject[:post_code]).to eq('2850') }
23
+ specify { expect(subject[:indigenous_status_identifier]).to eq('2') }
24
+ specify { expect(subject[:main_language_not_english]).to eq('1201') }
25
+ specify { expect(subject[:labour_force_status_identifier]).to eq('03') }
26
+ specify { expect(subject[:country_identifier]).to eq('0012') }
27
+ specify { expect(subject[:disability_flag]).to eq('Y') }
28
+ specify { expect(subject[:prior_education_achievement_flag]).to eq('Y') }
29
+ specify { expect(subject[:at_school_flag]).to eq('Y') }
30
+ specify { expect(subject[:english_proficiency_identifier]).to be_blank }
31
+ specify { expect(subject[:address_location]).to eq('Aarons Pass') }
32
+ specify { expect(subject[:extras]).to be_blank }
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe AvetmissData::Course do
4
+ context 'imports the NAT00030 file' do
5
+
6
+ context 'NAT File' do
7
+ specify { expect(AvetmissData::Course.file).not_to be_blank }
8
+ specify { expect(AvetmissData::Course.file).to eq('NAT00030') }
9
+ end
10
+
11
+ context 'NAT Record Parse' do
12
+ let!(:row) { 'UTE31206 Electrotechnology Fire Protection Control 0420115140313341111N' }
13
+ subject { AvetmissData::Course.parse(row) }
14
+
15
+ specify { expect(subject).not_to be_blank }
16
+ specify { expect(subject[:qualification_identifier]).to eq('UTE31206') }
17
+ specify { expect(subject[:qualification_name]).to eq('Electrotechnology Fire Protection Control') }
18
+ specify { expect(subject[:nominal_hours]).to eq('0420') }
19
+ specify { expect(subject[:qualification_recognition_identifier]).to eq('11') }
20
+ specify { expect(subject[:qualification_education_level_identifier]).to eq('514') }
21
+ specify { expect(subject[:qualification_education_field_identifier]).to eq('0313') }
22
+ specify { expect(subject[:anzsco_identifier]).to eq('341111') }
23
+ specify { expect(subject[:vet_flag]).to eq('N') }
24
+ specify { expect(subject[:extras]).to be_blank }
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe AvetmissData::Disability do
4
+ context 'imports the NAT00010 file' do
5
+
6
+ context 'NAT File' do
7
+ specify { expect(AvetmissData::Disability.file).not_to be_blank }
8
+ specify { expect(AvetmissData::Disability.file).to eq('NAT00090') }
9
+ end
10
+
11
+ context 'NAT Record Parse' do
12
+ let!(:row) { '12345 13' }
13
+ subject { AvetmissData::Disability.parse(row) }
14
+
15
+ specify { expect(subject).not_to be_blank }
16
+ specify { expect(subject[:client_identifier]).to eq('12345') }
17
+ specify { expect(subject[:disability_type_identifier]).to eq('13') }
18
+ specify { expect(subject[:extras]).to be_blank }
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe AvetmissData::Enrolment do
4
+ context 'imports the NAT00120 file' do
5
+
6
+ context 'NAT File' do
7
+ specify { expect(AvetmissData::Enrolment.file).not_to be_blank }
8
+ specify { expect(AvetmissData::Enrolment.file).to eq('NAT00120') }
9
+ end
10
+
11
+ context 'NAT Record Parse' do
12
+ let!(:row) { "4712 12345 BSBCUS402A UTE31206 160420131608201530700000134bc123 bc123 @@N70 0000Z 0000" }
13
+ subject { AvetmissData::Enrolment.parse(row) }
14
+
15
+ specify { expect(subject).not_to be_blank }
16
+ specify { expect(subject[:delivery_location_identifier]).to eq('4712') }
17
+ specify { expect(subject[:client_identifier]).to eq('12345') }
18
+ specify { expect(subject[:unit_competency_identifier]).to eq('BSBCUS402A') }
19
+ specify { expect(subject[:qualification_identifier]).to eq('UTE31206') }
20
+ specify { expect(subject[:enrolment_activity_start_date]).to eq('16042013') }
21
+ specify { expect(subject[:enrolment_activity_end_date]).to eq('16082015') }
22
+ specify { expect(subject[:delivery_mode_identifier]).to eq('30') }
23
+ specify { expect(subject[:national_outcome_identifier]).to eq('70') }
24
+ specify { expect(subject[:scheduled_hours]).to eq('0000') }
25
+ specify { expect(subject[:national_funding_source]).to eq('13') }
26
+ specify { expect(subject[:commencing_course_identifier]).to eq('4') }
27
+ specify { expect(subject[:new_apprenticeships_training_contract_identifier]).to eq('bc123') }
28
+ specify { expect(subject[:new_apprenticeships_client_identifier]).to eq('bc123') }
29
+ specify { expect(subject[:study_reason_identifier]).to eq('@@') }
30
+ specify { expect(subject[:vet_in_school_flag]).to eq('N') }
31
+ specify { expect(subject[:training_organisation_outcome_identifier]).to eq('70') }
32
+ specify { expect(subject[:state_training_authority_funding_source]).to eq('0') }
33
+ specify { expect(subject[:extras]).not_to be_blank }
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,4 @@
1
+ FactoryGirl.define do
2
+ factory :base, class: 'AvetmissData::Base' do
3
+ end
4
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe AvetmissData::QualCompletion do
4
+ context 'imports the NAT00130 file' do
5
+
6
+ context 'NAT File' do
7
+ specify { expect(AvetmissData::QualCompletion.file).not_to be_blank }
8
+ specify { expect(AvetmissData::QualCompletion.file).to eq('NAT00130') }
9
+ end
10
+
11
+ context 'NAT Record Parse' do
12
+ let!(:row) { "01010 UTE31206 12345 2013Y" }
13
+ subject { AvetmissData::QualCompletion.parse(row) }
14
+
15
+ specify { expect(subject).not_to be_blank }
16
+ specify { expect(subject[:training_organisation_identifier]).to eq('01010') }
17
+ specify { expect(subject[:qualification_identifier]).to eq('UTE31206') }
18
+ specify { expect(subject[:client_identifier]).to eq('12345') }
19
+ specify { expect(subject[:program_completed_year]).to eq('2013') }
20
+ specify { expect(subject[:qualification_issued_flag]).to eq('Y') }
21
+ specify { expect(subject[:extras]).to be_blank }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe AvetmissData::RtoDeliveryLocation do
4
+ context 'imports the NAT00020 file' do
5
+
6
+ context 'NAT File' do
7
+ specify { expect(AvetmissData::RtoDeliveryLocation.file).not_to be_blank }
8
+ specify { expect(AvetmissData::RtoDeliveryLocation.file).to eq('NAT00020') }
9
+ end
10
+
11
+ context 'NAT Record Parse' do
12
+ let!(:row) { '01010 4707 Park View Motor Inn-Wangaratta 367702WANGARATTA 1101' }
13
+ subject { AvetmissData::RtoDeliveryLocation.parse(row) }
14
+
15
+ specify { expect(subject[:training_organisation_identifier]).to eq('01010') }
16
+ specify { expect(subject[:training_organisation_delivery_location_identifier]).to eq('4707') }
17
+ specify { expect(subject[:training_organisation_delivery_location_name]).to eq('Park View Motor Inn-Wangaratta') }
18
+ specify { expect(subject[:post_code]).to eq('3677') }
19
+ specify { expect(subject[:state_identifier]).to eq('02') }
20
+ specify { expect(subject[:address_location]).to eq('WANGARATTA') }
21
+ specify { expect(subject[:country_identifier]).to eq('1101') }
22
+ specify { expect(subject[:extras]).to be_blank }
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe AvetmissData::Rto do
4
+ context 'imports the NAT00010 file' do
5
+
6
+ context 'NAT File' do
7
+ specify { expect(AvetmissData::Rto.file).not_to be_blank }
8
+ specify { expect(AvetmissData::Rto.file).to eq('NAT00010') }
9
+ end
10
+
11
+ context 'NAT Record Parse' do
12
+ let!(:row) { '01010 JobReady Solutions 91Suite 203, 84 Alexander Street Crows Nest 206501Kristina Peebles 0290185525 0211111111 prakritip@jobready.com.au ' }
13
+ subject { AvetmissData::Rto.parse(row) }
14
+
15
+ specify { expect(subject).not_to be_blank }
16
+ specify { expect(subject[:training_organisation_identifier]).to eq('01010') }
17
+ specify { expect(subject[:training_organisation_name]).to eq('JobReady Solutions') }
18
+ specify { expect(subject[:training_organisation_type_identifier]).to eq('91') }
19
+ specify { expect(subject[:address_first_line]).to eq('Suite 203, 84 Alexander Street') }
20
+ specify { expect(subject[:address_second_line]).to be_blank }
21
+ specify { expect(subject[:address_location]).to eq('Crows Nest') }
22
+ specify { expect(subject[:post_code]).to eq('2065') }
23
+ specify { expect(subject[:state_identifier]).to eq('01') }
24
+ specify { expect(subject[:extras]).not_to be_blank }
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,33 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+
8
+ require 'bundler/setup'
9
+ Bundler.require(:default, :development)
10
+
11
+ require 'simplecov'
12
+ SimpleCov.start
13
+
14
+ require 'codeclimate-test-reporter'
15
+ CodeClimate::TestReporter.start
16
+
17
+ require 'avetmiss_data'
18
+
19
+ RSpec.configure do |config|
20
+ config.treat_symbols_as_metadata_keys_with_true_values = true
21
+ config.run_all_when_everything_filtered = true
22
+ config.filter_run :focus
23
+
24
+ # Run specs in random order to surface order dependencies. If you find an
25
+ # order dependency and want to debug it, you can fix the order by providing
26
+ # the seed, which is printed after each run.
27
+ # --seed 1234
28
+ config.order = 'random'
29
+
30
+ config.include FactoryGirl::Syntax::Methods
31
+ end
32
+
33
+ require_relative 'factories.rb'
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe AvetmissData::UnitOfCompetency do
4
+ context 'imports the NAT00060 file' do
5
+
6
+ context 'NAT File' do
7
+ specify { expect(AvetmissData::UnitOfCompetency.file).not_to be_blank }
8
+ specify { expect(AvetmissData::UnitOfCompetency.file).to eq('NAT00060') }
9
+ end
10
+
11
+ context 'NAT Record Parse' do
12
+ let!(:row) { 'MAE1 Academic English 1 000000N0025' }
13
+ subject { AvetmissData::UnitOfCompetency.parse(row) }
14
+
15
+ specify { expect(subject).not_to be_blank }
16
+ specify { expect(subject[:unit_competency_flag]).to eq('M') }
17
+ specify { expect(subject[:unit_competency_identifier]).to eq('AE1') }
18
+ specify { expect(subject[:unit_competency_name]).to eq('Academic English 1') }
19
+ specify { expect(subject[:unit_competency_education_field_identifier]).to eq('000000') }
20
+ specify { expect(subject[:vet_flag]).to eq('N') }
21
+ specify { expect(subject[:nominal_hours]).to eq('0025') }
22
+ specify { expect(subject[:extras]).to be_blank }
23
+ end
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,207 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: avetmiss_data
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Brenton Fletcher
8
+ - Jehanzeb Khan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-03-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '1.0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: '1.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rspec
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: '2.14'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: '2.14'
42
+ - !ruby/object:Gem::Dependency
43
+ name: factory_girl
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: '4.4'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '4.4'
56
+ - !ruby/object:Gem::Dependency
57
+ name: cane
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: '2.6'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '2.6'
70
+ - !ruby/object:Gem::Dependency
71
+ name: simplecov
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '0.7'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: '0.7'
84
+ - !ruby/object:Gem::Dependency
85
+ name: byebug
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ version: '2.7'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ~>
96
+ - !ruby/object:Gem::Version
97
+ version: '2.7'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rake
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ~>
103
+ - !ruby/object:Gem::Version
104
+ version: '10.1'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ version: '10.1'
112
+ - !ruby/object:Gem::Dependency
113
+ name: codeclimate-test-reporter
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ~>
117
+ - !ruby/object:Gem::Version
118
+ version: '0.3'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '0.3'
126
+ - !ruby/object:Gem::Dependency
127
+ name: activesupport
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '='
131
+ - !ruby/object:Gem::Version
132
+ version: 3.2.17
133
+ type: :runtime
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - '='
138
+ - !ruby/object:Gem::Version
139
+ version: 3.2.17
140
+ description: Parsing and building AVETMISS files
141
+ email:
142
+ - brentonf@jobready.com.au
143
+ - jehanzebk@jobready.com.au
144
+ executables: []
145
+ extensions: []
146
+ extra_rdoc_files: []
147
+ files:
148
+ - .gitignore
149
+ - .rspec
150
+ - .travis.yml
151
+ - Gemfile
152
+ - Gemfile.lock
153
+ - LICENSE.txt
154
+ - README.md
155
+ - Rakefile
156
+ - avetmiss_data.gemspec
157
+ - lib/avetmiss_data.rb
158
+ - lib/avetmiss_data/achievement.rb
159
+ - lib/avetmiss_data/base.rb
160
+ - lib/avetmiss_data/client.rb
161
+ - lib/avetmiss_data/client_postal_detail.rb
162
+ - lib/avetmiss_data/course.rb
163
+ - lib/avetmiss_data/disability.rb
164
+ - lib/avetmiss_data/enrolment.rb
165
+ - lib/avetmiss_data/qual_completion.rb
166
+ - lib/avetmiss_data/rto.rb
167
+ - lib/avetmiss_data/rto_delivery_location.rb
168
+ - lib/avetmiss_data/unit_of_competency.rb
169
+ - lib/avetmiss_data/version.rb
170
+ - spec/achievement_spec.rb
171
+ - spec/base_spec.rb
172
+ - spec/client_postal_detail_spec.rb
173
+ - spec/client_spec.rb
174
+ - spec/course_spec.rb
175
+ - spec/disability_spec.rb
176
+ - spec/enrolment_spec.rb
177
+ - spec/factories.rb
178
+ - spec/qual_completion_spec.rb
179
+ - spec/rto_delivery_location_spec.rb
180
+ - spec/rto_spec.rb
181
+ - spec/spec_helper.rb
182
+ - spec/unit_of_competency_spec.rb
183
+ homepage: http://github.com/jobready/avetmiss_data
184
+ licenses:
185
+ - MIT
186
+ metadata: {}
187
+ post_install_message:
188
+ rdoc_options: []
189
+ require_paths:
190
+ - lib
191
+ required_ruby_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ! '>='
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ required_rubygems_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ! '>='
199
+ - !ruby/object:Gem::Version
200
+ version: 1.3.6
201
+ requirements: []
202
+ rubyforge_project:
203
+ rubygems_version: 2.2.2
204
+ signing_key:
205
+ specification_version: 4
206
+ summary: Gem for parsing and building AVETMISS (NAT) Files
207
+ test_files: []