smartwaiver-sdk 4.2.0 → 4.2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 944ad664843846b1979e866281ea7a48b046e59ff3dc6b11dcb64876ba0dcb6c
|
4
|
+
data.tar.gz: c9f853740b112817058fa5e30917e76eeb91166200f55975f03b918d8787041f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 277bbbd16e45fd9ab4064c67e5fcc572601c08408179b01a68b4600e40d6ede0375ad056b647793ccc7abcc0c451f45c1e669caaa5ad723cce58f507b7a2274c
|
7
|
+
data.tar.gz: ccbb645101c5f0d607b3027e4e0338577fd16ced1f7f77cbfb452ff9c9a306564009850e642363f6b447106577437f3e4882545afac4ad7977f85a40be2dd6e5
|
@@ -17,12 +17,26 @@ require 'smartwaiver-sdk/smartwaiver_base'
|
|
17
17
|
|
18
18
|
class SmartwaiverDynamicTemplateData
|
19
19
|
|
20
|
-
attr_accessor :adult, :participants, :guardian
|
20
|
+
attr_accessor :adult, :participants, :guardian, :address_line_one, :address_line_two, :address_country,
|
21
|
+
:address_state, :address_zip, :email, :emergency_contact_name, :emergency_contact_phone,
|
22
|
+
:insurance_carrier, :insurance_policy_number, :drivers_license_state, :drivers_license_number
|
21
23
|
|
22
24
|
def initialize(adult = true)
|
23
25
|
@adult = adult
|
24
26
|
@participants = []
|
25
27
|
@guardian = SmartwaiverGuardian.new
|
28
|
+
@address_line_one = nil
|
29
|
+
@address_line_two = nil
|
30
|
+
@address_country = nil
|
31
|
+
@address_state = nil
|
32
|
+
@address_zip = nil
|
33
|
+
@email = nil
|
34
|
+
@emergency_contact_name = nil
|
35
|
+
@emergency_contact_phone = nil
|
36
|
+
@insurance_carrier = nil
|
37
|
+
@insurance_policy_number = nil
|
38
|
+
@drivers_license_state = nil
|
39
|
+
@drivers_license_number = nil
|
26
40
|
end
|
27
41
|
|
28
42
|
def add_participant(participant)
|
@@ -34,7 +48,23 @@ class SmartwaiverDynamicTemplateData
|
|
34
48
|
@participants.each do |participant|
|
35
49
|
participants_for_json.push(participant.for_json)
|
36
50
|
end
|
37
|
-
|
51
|
+
json = {}
|
52
|
+
json['adult'] = @adult
|
53
|
+
json['participants'] = participants_for_json
|
54
|
+
json['guardian'] = @guardian.for_json
|
55
|
+
json['addressLineOne'] = @address_line_one if (!@address_line_one.nil?)
|
56
|
+
json['addressLineTwo'] = @address_line_two if (!@address_line_two.nil?)
|
57
|
+
json['addressCountry'] = @address_country if (!@address_country.nil?)
|
58
|
+
json['addressState'] = @address_state if (!@address_state.nil?)
|
59
|
+
json['addressZip'] = @address_zip if (!@address_zip.nil?)
|
60
|
+
json['email'] = @email if (!@email.nil?)
|
61
|
+
json['emergencyContactName'] = @emergency_contact_name if (!@emergency_contact_name.nil?)
|
62
|
+
json['emergencyContactPhone'] = @emergency_contact_phone if (!@emergency_contact_phone.nil?)
|
63
|
+
json['insuranceCarrier'] = @insurance_carrier if (!@insurance_carrier.nil?)
|
64
|
+
json['insurancePolicyNumber'] = @insurance_policy_number if (!@insurance_policy_number.nil?)
|
65
|
+
json['driversLicenseState'] = @drivers_license_state if (!@drivers_license_state.nil?)
|
66
|
+
json['driversLicenseNumber'] = @drivers_license_number if (!@drivers_license_number.nil?)
|
67
|
+
json
|
38
68
|
end
|
39
69
|
end
|
40
70
|
|
@@ -15,6 +15,18 @@ describe SmartwaiverDynamicTemplateData do
|
|
15
15
|
expect(td.adult).to eq(true)
|
16
16
|
expect(td.participants).to eq([])
|
17
17
|
expect(td.guardian).to be_kind_of(SmartwaiverGuardian)
|
18
|
+
expect(td.address_line_one).to be_nil
|
19
|
+
expect(td.address_line_two).to be_nil
|
20
|
+
expect(td.address_country).to be_nil
|
21
|
+
expect(td.address_state).to be_nil
|
22
|
+
expect(td.address_zip).to be_nil
|
23
|
+
expect(td.email).to be_nil
|
24
|
+
expect(td.emergency_contact_name).to be_nil
|
25
|
+
expect(td.emergency_contact_phone).to be_nil
|
26
|
+
expect(td.insurance_carrier).to be_nil
|
27
|
+
expect(td.insurance_policy_number).to be_nil
|
28
|
+
expect(td.drivers_license_state).to be_nil
|
29
|
+
expect(td.drivers_license_number).to be_nil
|
18
30
|
end
|
19
31
|
|
20
32
|
it "#initialize with non default adult" do
|
@@ -34,7 +46,7 @@ describe SmartwaiverDynamicTemplateData do
|
|
34
46
|
expect(td.participants).to eq([p])
|
35
47
|
end
|
36
48
|
|
37
|
-
it "#for_json" do
|
49
|
+
it "#for_json minimal" do
|
38
50
|
td = SmartwaiverDynamicTemplateData.new
|
39
51
|
|
40
52
|
p = SmartwaiverParticipant.new
|
@@ -52,6 +64,52 @@ describe SmartwaiverDynamicTemplateData do
|
|
52
64
|
}
|
53
65
|
expect(a).to eq(a_expected)
|
54
66
|
end
|
67
|
+
|
68
|
+
it "#for_json all fields" do
|
69
|
+
td = SmartwaiverDynamicTemplateData.new(false)
|
70
|
+
|
71
|
+
p = SmartwaiverParticipant.new
|
72
|
+
p.first_name = "Rocky"
|
73
|
+
p.last_name = "RockChuck"
|
74
|
+
p.gender = "M"
|
75
|
+
p.dob = "2010-01-01"
|
76
|
+
|
77
|
+
td.add_participant(p)
|
78
|
+
|
79
|
+
td.address_line_one = "123 Main St."
|
80
|
+
td.address_line_two = "Apt A"
|
81
|
+
td.address_country = "US"
|
82
|
+
td.address_state = "OR"
|
83
|
+
td.address_zip = "97703"
|
84
|
+
td.email = "rocky@smartwaiver.com"
|
85
|
+
td.emergency_contact_name = "Mrs Rocky"
|
86
|
+
td.emergency_contact_phone = "800-555-1212"
|
87
|
+
td.insurance_carrier = "Aetna"
|
88
|
+
td.insurance_policy_number = "H01"
|
89
|
+
td.drivers_license_state = "OR"
|
90
|
+
td.drivers_license_number = "010101"
|
91
|
+
|
92
|
+
a = td.for_json
|
93
|
+
|
94
|
+
a_expected = {
|
95
|
+
"adult"=>false,
|
96
|
+
"participants"=>[{"firstName"=>"Rocky", "lastName"=>"RockChuck", "gender" => "M", "dob" => "2010-01-01"}],
|
97
|
+
"guardian"=>{"participant"=>false},
|
98
|
+
"addressLineOne" => "123 Main St.",
|
99
|
+
"addressLineTwo" => "Apt A",
|
100
|
+
"addressCountry" => "US",
|
101
|
+
"addressState" => "OR",
|
102
|
+
"addressZip" => "97703",
|
103
|
+
"email" => "rocky@smartwaiver.com",
|
104
|
+
"emergencyContactName" => "Mrs Rocky",
|
105
|
+
"emergencyContactPhone" => "800-555-1212",
|
106
|
+
"insuranceCarrier" => "Aetna",
|
107
|
+
"insurancePolicyNumber" => "H01",
|
108
|
+
"driversLicenseState" => "OR",
|
109
|
+
"driversLicenseNumber" => "010101"
|
110
|
+
}
|
111
|
+
expect(a).to eq(a_expected)
|
112
|
+
end
|
55
113
|
end
|
56
114
|
end
|
57
115
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartwaiver-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Smartwaiver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The Smartwaiver SDK uses version 4 of the Smartwaiver API
|
14
14
|
email:
|