mla_active_duty_status 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/lib/mla_active_duty_status/client.rb +10 -6
- data/lib/mla_active_duty_status/configuration.rb +11 -1
- data/lib/mla_active_duty_status/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b15624664fec1445ea32ab16bcbe90d076e2d47e
|
4
|
+
data.tar.gz: 97818f28029ade7fd48f5744601392a55a0646cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a63119a765cdc838fe092665a7df41fcd645204f51b793cffb771957b9c9568127590a4c5d1db129e9b3e4999f4bb26d696823fab22bd84e2f85b1ce224bbef4
|
7
|
+
data.tar.gz: 64690bb6da9f0169089d10c45cac977a0eb3d7e354f4585f1817c5944b3e58b566f2cc01bdf0389cbf3394060ddac435c131ff1641af1c288b8faa57cf3a7a3e
|
data/README.md
CHANGED
@@ -109,6 +109,29 @@ then set the configuration like this:
|
|
109
109
|
MlaActiveDutyStatus.configuration.ssl_verify = false
|
110
110
|
```
|
111
111
|
|
112
|
+
## Configuration
|
113
|
+
|
114
|
+
Set value for configuration:
|
115
|
+
```ruby
|
116
|
+
MlaActiveDutyStatus.configuration.logging = true
|
117
|
+
```
|
118
|
+
|
119
|
+
* max_years_for_age_check - Ages older than this will be flagged as invalid.
|
120
|
+
|
121
|
+
* logging - if true or in Rails development environment will log to a local file called mechlog.log
|
122
|
+
|
123
|
+
Defaults:
|
124
|
+
```ruby
|
125
|
+
@max_years_for_age_check = 100
|
126
|
+
@mla_host = 'mla.dmdc.osd.mil'
|
127
|
+
@mla_path = '/mla/single_record.xhtml'
|
128
|
+
@ssl_verify = true
|
129
|
+
@ca_path = nil
|
130
|
+
@logging = false
|
131
|
+
@open_timeout = 10
|
132
|
+
@read_timeout = 10
|
133
|
+
```
|
134
|
+
|
112
135
|
## Contributing
|
113
136
|
|
114
137
|
Bug reports and pull requests are welcome on GitHub at https://github.com/jimjames99/mla_active_duty_status.
|
@@ -8,17 +8,20 @@ module MlaActiveDutyStatus
|
|
8
8
|
|
9
9
|
def self.call_mla_site(mla)
|
10
10
|
browser = Mechanize.new do |agent|
|
11
|
-
agent.open_timeout =
|
12
|
-
agent.read_timeout =
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
agent.open_timeout = MlaActiveDutyStatus.configuration.open_timeout
|
12
|
+
agent.read_timeout = MlaActiveDutyStatus.configuration.read_timeout
|
13
|
+
if MlaActiveDutyStatus.configuration.logging || (defined?(Rails) && Rails.env.development?)
|
14
|
+
log = Logger.new('mechlog.log')
|
15
|
+
log.level = Logger::DEBUG
|
16
|
+
agent.log = log
|
17
|
+
end
|
16
18
|
agent.user_agent_alias = 'Mac Firefox'
|
17
19
|
end
|
18
20
|
if MlaActiveDutyStatus.configuration.ssl_verify
|
19
21
|
browser.agent.http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
20
22
|
cert_store = OpenSSL::X509::Store.new
|
21
|
-
if
|
23
|
+
if MlaActiveDutyStatus.configuration.ca_path
|
24
|
+
ca_path = File.expand_path(MlaActiveDutyStatus.configuration.ca_path)
|
22
25
|
cert_store.add_file ca_path
|
23
26
|
browser.agent.http.cert_store = cert_store
|
24
27
|
end
|
@@ -27,6 +30,7 @@ module MlaActiveDutyStatus
|
|
27
30
|
end
|
28
31
|
host = MlaActiveDutyStatus.configuration.mla_host
|
29
32
|
path = MlaActiveDutyStatus.configuration.mla_path
|
33
|
+
browser.get("https://#{host}")
|
30
34
|
page = browser.get("https://#{host}#{path}")
|
31
35
|
mla_form = page.form('myForm')
|
32
36
|
mla_form.ssn = mla.ssn
|
@@ -15,7 +15,14 @@ module MlaActiveDutyStatus
|
|
15
15
|
end
|
16
16
|
|
17
17
|
class Configuration
|
18
|
-
attr_accessor :mla_host,
|
18
|
+
attr_accessor :mla_host,
|
19
|
+
:mla_path,
|
20
|
+
:max_years_for_age_check,
|
21
|
+
:ssl_verify,
|
22
|
+
:ca_path,
|
23
|
+
:logging,
|
24
|
+
:open_timeout,
|
25
|
+
:read_timeout
|
19
26
|
|
20
27
|
def initialize
|
21
28
|
@max_years_for_age_check = 100
|
@@ -23,6 +30,9 @@ module MlaActiveDutyStatus
|
|
23
30
|
@mla_path = '/mla/single_record.xhtml'
|
24
31
|
@ssl_verify = true
|
25
32
|
@ca_path = nil
|
33
|
+
@logging = false
|
34
|
+
@open_timeout = 10
|
35
|
+
@read_timeout = 10
|
26
36
|
end
|
27
37
|
|
28
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mla_active_duty_status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jimjames99
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|