crowd_pay 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +38 -0
- data/.rspec +1 -0
- data/.travis.yml +24 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +69 -0
- data/LICENSE +21 -0
- data/README.md +12 -0
- data/Rakefile +7 -0
- data/crowd_pay.gemspec +17 -0
- data/lib/crowd_pay.rb +163 -0
- data/lib/crowd_pay/account.rb +83 -0
- data/lib/crowd_pay/asset.rb +26 -0
- data/lib/crowd_pay/escrow.rb +22 -0
- data/lib/crowd_pay/investor.rb +51 -0
- data/lib/crowd_pay/transaction.rb +52 -0
- data/lib/crowd_pay/verification.rb +42 -0
- data/lib/crowd_pay/version.rb +3 -0
- data/spec/account_spec.rb +287 -0
- data/spec/asset_spec.rb +34 -0
- data/spec/crowd_pay_spec.rb +187 -0
- data/spec/escrow_spec.rb +42 -0
- data/spec/factories/accounts.rb +42 -0
- data/spec/factories/assets.rb +10 -0
- data/spec/factories/escrows.rb +12 -0
- data/spec/factories/investors.rb +31 -0
- data/spec/factories/transactions.rb +14 -0
- data/spec/factories/verifications.rb +105 -0
- data/spec/investor_spec.rb +198 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/transaction_spec.rb +176 -0
- data/spec/verification_spec.rb +91 -0
- metadata +107 -0
data/spec/asset_spec.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CrowdPay::Asset do
|
4
|
+
|
5
|
+
context "validate factories" do
|
6
|
+
it "should validate the asset factories" do
|
7
|
+
asset = FactoryGirl.build(:asset)
|
8
|
+
expect(asset.valid?).to be(true)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context "get" do
|
13
|
+
context "positive case" do
|
14
|
+
it "should get asset with id" do
|
15
|
+
account_id = "82980"
|
16
|
+
id = "471277"
|
17
|
+
stub_request(:get, "https://test.crowdpay.com/Crowdfunding/api/Account/#{account_id}/Assets/#{id}").to_return(:status => 200, :body => "{\"id\":471277,\"description\":\"ACME Wealth Agriculture 101, LLC\",\"number\":\"2000001\",\"sold_date\":\"null\",\"market_value\":\"250\",\"Transactions\":[]}")
|
18
|
+
asset = CrowdPay::Asset.find(account_id, id)
|
19
|
+
expect(asset).to be_an(CrowdPay::Asset)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "negative case" do
|
24
|
+
it "should not get asset with id" do
|
25
|
+
account_id = "82980"
|
26
|
+
id = "invalid_asset_id"
|
27
|
+
stub_request(:get, "https://test.crowdpay.com/Crowdfunding/api/Account/#{account_id}/Assets/#{id}").to_return(:status => 405, :body => "{\"Message\":\"The requested resource does not support http method 'GET'.\"}")
|
28
|
+
asset = CrowdPay::Asset.find(account_id, id)
|
29
|
+
expect(asset.errors[:api]).to eq(["The requested resource does not support http method 'GET'."])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'socket'
|
3
|
+
|
4
|
+
class DummyClass
|
5
|
+
include ActiveModel::AttributeMethods
|
6
|
+
include ActiveModel::Validations
|
7
|
+
include CrowdPay
|
8
|
+
attr_accessor :x, :y
|
9
|
+
register_association :node_ones, class_name: "NodeOneClass"
|
10
|
+
register_association :node_twos, class_name: "NodeTwoClass"
|
11
|
+
end
|
12
|
+
|
13
|
+
class NodeOneClass
|
14
|
+
include ActiveModel::AttributeMethods
|
15
|
+
include ActiveModel::Validations
|
16
|
+
include CrowdPay
|
17
|
+
attr_accessor :a, :b
|
18
|
+
end
|
19
|
+
|
20
|
+
class NodeTwoClass
|
21
|
+
include ActiveModel::AttributeMethods
|
22
|
+
include ActiveModel::Validations
|
23
|
+
include CrowdPay
|
24
|
+
attr_accessor :j, :k
|
25
|
+
end
|
26
|
+
|
27
|
+
RSpec.describe CrowdPay, :type => :lib do
|
28
|
+
|
29
|
+
context "Test if the Class included CrowdPay methods properly" do
|
30
|
+
it "should include crowd pay module" do
|
31
|
+
expect(DummyClass.connection).not_to be(nil)
|
32
|
+
|
33
|
+
dummy = DummyClass.new
|
34
|
+
expect(dummy.respond_to?(:connection)).to be(true)
|
35
|
+
expect(dummy.class.respond_to?(:connection)).to be(true)
|
36
|
+
|
37
|
+
expect(dummy.class.respond_to?(:domain)).to be(true)
|
38
|
+
expect(dummy.class.respond_to?(:api_key)).to be(true)
|
39
|
+
expect(dummy.class.respond_to?(:portal_key)).to be(true)
|
40
|
+
|
41
|
+
expect(dummy.class.respond_to?(:get)).to be(true)
|
42
|
+
expect(dummy.class.respond_to?(:post)).to be(true)
|
43
|
+
expect(dummy.class.respond_to?(:put)).to be(true)
|
44
|
+
expect(dummy.class.respond_to?(:delete)).to be(true)
|
45
|
+
|
46
|
+
expect(dummy.class.connection).not_to be(nil)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should include the initialize method which accepts multiple attributes" do
|
50
|
+
dummy = DummyClass.new(x: 1, y: "abcde")
|
51
|
+
expect(dummy.x).to eq(1)
|
52
|
+
expect(dummy.y).to eq("abcde")
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should include the initialize method which accepts associated attributes" do
|
56
|
+
dummy = DummyClass.new(x: 1, y: "abcde")
|
57
|
+
expect(dummy.x).to eq(1)
|
58
|
+
expect(dummy.y).to eq("abcde")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context "Instance Methods" do
|
63
|
+
it "initialize" do
|
64
|
+
dummy = DummyClass.new
|
65
|
+
expect(dummy.x).to be(nil)
|
66
|
+
expect(dummy.y).to be(nil)
|
67
|
+
dummy.send :initialize, {x: 1, y: 2, node_ones: [{a: "Banana", b: "Mango"}], node_twos: [{j: "Grapes", k: "Apple"}]}
|
68
|
+
expect(dummy.x).to be(1)
|
69
|
+
expect(dummy.y).to be(2)
|
70
|
+
expect(dummy.node_ones.first).to be_a(NodeOneClass)
|
71
|
+
expect(dummy.node_ones.first.a).to eq("Banana")
|
72
|
+
expect(dummy.node_ones.first.b).to eq("Mango")
|
73
|
+
expect(dummy.node_twos.first).to be_a(NodeTwoClass)
|
74
|
+
expect(dummy.node_twos.first.j).to eq("Grapes")
|
75
|
+
expect(dummy.node_twos.first.k).to eq("Apple")
|
76
|
+
end
|
77
|
+
|
78
|
+
it "assign_attributes" do
|
79
|
+
dummy = DummyClass.new
|
80
|
+
response = double("response", :status => 201, body: "{\"x\":1,\"y\":2}")
|
81
|
+
hash = JSON.parse(response.body)
|
82
|
+
dummy.assign_attributes(hash)
|
83
|
+
expect(dummy.x).to be(1)
|
84
|
+
expect(dummy.y).to be(2)
|
85
|
+
end
|
86
|
+
|
87
|
+
# it '#attributes' do
|
88
|
+
# dummy = DummyClass.new x: 1, y: 'abcde'
|
89
|
+
# expect(dummy.attributes).to eq(x: 1, y: 'abcde')
|
90
|
+
# end
|
91
|
+
|
92
|
+
context "populate_errors" do
|
93
|
+
it "should display the errors[:api] if status is 405" do
|
94
|
+
dummy = DummyClass.new
|
95
|
+
body = {'Message' => "The requested resource does not support http method 'GET'."}
|
96
|
+
dummy.populate_errors(body)
|
97
|
+
expect(dummy.errors[:api]).to eq(["The requested resource does not support http method 'GET'."])
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should display the errors[:api] if status is 400" do
|
101
|
+
dummy = DummyClass.new
|
102
|
+
body = {'Message'=>'The request is invalid.', 'ModelState'=>{'investor'=>['An error has occurred.', 'An error has occurred.', 'An error has occurred.'], 'investor.tax_id_number'=>['The tax_id_number field is required.'], 'investor.created_by_ip_address'=>['The created_by_ip_address field is required.']}}
|
103
|
+
dummy.populate_errors(body)
|
104
|
+
expect(dummy.errors[:api]).to eq(["The request is invalid."])
|
105
|
+
expect(dummy.errors[:tax_id_number]).to eq(["The tax_id_number field is required."])
|
106
|
+
expect(dummy.errors[:created_by_ip_address]).to eq(["The created_by_ip_address field is required."])
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should display the errors[:api] if status is 409" do
|
110
|
+
dummy = DummyClass.new
|
111
|
+
body = {'Code'=>'20000', 'Message'=>'Investor with same tax id already exists.', 'Model'=>'Investor', 'ModelObject'=>{'id'=>78629, 'investor_key'=>'a433d29f-837a-4f84-a7bc-b7e97c677c07', 'tax_id_number'=>'*****2025', 'first_name'=>'Investor First', 'middle_name'=>'Investor Middle', 'last_name'=>'Investor Last', 'name'=>'Investor First Investor Middle Investor Last', 'birth_date'=>'1985-04-07T00:00:00', 'mailing_address_1'=>'123 Ave A', 'mailing_address_2'=>nil, 'mailing_city'=>'Somewhere', 'mailing_state'=>'TX', 'mailing_zip'=>'79109', 'mailing_country'=>nil, 'is_mailing_address_foreign'=>false, 'legal_address_1'=>'123 Ave A', 'legal_address_2'=>nil, 'legal_city'=>'Somewhere', 'legal_state'=>'TX', 'legal_zip'=>'79109', 'legal_country'=>nil, 'is_legal_address_foreign'=>false, 'primary_phone'=>'1112223333', 'secondary_phone'=>'2223334444', 'is_person'=>true, 'email'=>'cgrimes@qwinixtech.com', 'is_cip_satisfied'=>false, 'portal_investor_number'=>'yourinvestornumber', 'created_by_ip_address'=>'192.168.2.61', 'Accounts'=>[]}}
|
112
|
+
dummy.populate_errors(body)
|
113
|
+
expect(dummy.errors[:api]).to eq(['Investor with same tax id already exists.'])
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context "Class Methods" do
|
119
|
+
it "create_connection" do
|
120
|
+
dummy = DummyClass.new
|
121
|
+
expect(dummy.connection).to be_a(Faraday::Connection)
|
122
|
+
expect(dummy.connection.headers["X-ApiKey"]).not_to be_nil
|
123
|
+
expect(dummy.connection.headers["X-PortalKey"]).not_to be_nil
|
124
|
+
end
|
125
|
+
|
126
|
+
it "parse with status 201" do
|
127
|
+
response = double("response", :status => 201, body: "{\"x\":1,\"y\":2}")
|
128
|
+
dummy = DummyClass.parse(response)
|
129
|
+
expect(dummy.x).to be(1)
|
130
|
+
expect(dummy.y).to be(2)
|
131
|
+
end
|
132
|
+
|
133
|
+
it "parse with status 409" do
|
134
|
+
response = double("response", :status => 409, body: "{\"Code\":\"20000\",\"Message\":\"Investor with same tax id already exists.\",\"Model\":\"Investor\",\"ModelObject\":{\"x\":1,\"y\":2}}")
|
135
|
+
dummy = DummyClass.parse(response)
|
136
|
+
expect(dummy.x).to be(1)
|
137
|
+
expect(dummy.y).to be(2)
|
138
|
+
end
|
139
|
+
|
140
|
+
it "parse with status 400" do
|
141
|
+
response = double("response", :status => 400, body: "{\"Message\":\"The request is invalid.\",\"ModelState\":{\"investor.is_person\":[\"An error has occurred.\"]}}")
|
142
|
+
dummy = DummyClass.parse(response)
|
143
|
+
expect(dummy.errors.messages).not_to be_empty
|
144
|
+
end
|
145
|
+
|
146
|
+
it "get" do
|
147
|
+
url = "https://test.crowdpay.com/Crowdfunding/api/DummyClass/investor_key"
|
148
|
+
stub_request(:get, url).to_return(:status => 200, :body => "{\"x\":1,\"y\":2}")
|
149
|
+
path = "Crowdfunding/api/DummyClass/investor_key"
|
150
|
+
response = DummyClass.get(path)
|
151
|
+
expect(response.status).to eq(200)
|
152
|
+
expect(response.body).to eq("{\"x\":1,\"y\":2}")
|
153
|
+
end
|
154
|
+
|
155
|
+
it "post" do
|
156
|
+
url = "https://test.crowdpay.com/Crowdfunding/api/DummyClass"
|
157
|
+
stub_request(:post, url).to_return(:status => 201, :body => "{\"x\":1,\"y\":2}")
|
158
|
+
path = "Crowdfunding/api/DummyClass"
|
159
|
+
response = DummyClass.post(path, {"x" => 1, "y" => 2})
|
160
|
+
expect(response.status).to eq(201)
|
161
|
+
expect(response.body).to eq("{\"x\":1,\"y\":2}")
|
162
|
+
end
|
163
|
+
|
164
|
+
it "put" do
|
165
|
+
url = "https://test.crowdpay.com/Crowdfunding/api/DummyClass/1"
|
166
|
+
stub_request(:put, url).to_return(:status => 201, :body => "{\"x\":1,\"y\":2}")
|
167
|
+
path = "Crowdfunding/api/DummyClass/1"
|
168
|
+
response = DummyClass.put(path, {"x" => 1, "y" => 2})
|
169
|
+
expect(response.status).to eq(201)
|
170
|
+
expect(response.body).to eq("{\"x\":1,\"y\":2}")
|
171
|
+
end
|
172
|
+
|
173
|
+
it "delete" do
|
174
|
+
url = "https://test.crowdpay.com/Crowdfunding/api/DummyClass/1"
|
175
|
+
stub_request(:delete, url).to_return(:status => 201, :body => "{\"x\":1,\"y\":2}")
|
176
|
+
path = "Crowdfunding/api/DummyClass/1"
|
177
|
+
response = DummyClass.delete(path)
|
178
|
+
expect(response.status).to eq(201)
|
179
|
+
expect(response.body).to eq("{\"x\":1,\"y\":2}")
|
180
|
+
end
|
181
|
+
|
182
|
+
it "register_association" do
|
183
|
+
expect(DummyClass::associations).to eq({node_ones: {class_name: "NodeOneClass"}, node_twos: {class_name: "NodeTwoClass"}})
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
end
|
data/spec/escrow_spec.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CrowdPay::Escrow do
|
4
|
+
let(:escrow) { FactoryGirl.build(:escrow) }
|
5
|
+
|
6
|
+
context "validate factories" do
|
7
|
+
it "should validate the asset factories" do
|
8
|
+
escrow = FactoryGirl.build(:escrow)
|
9
|
+
expect(escrow.valid?).to be(true)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context ".find" do
|
14
|
+
it "find all escrows" do
|
15
|
+
stub_request(:get, 'https://test.crowdpay.com/Crowdfunding/api/Escrows')
|
16
|
+
.to_return status: 200, body: [FactoryGirl.attributes_for(:escrow)].to_json
|
17
|
+
escrow = CrowdPay::Escrow.find.first
|
18
|
+
expect(escrow).to be_an(CrowdPay::Escrow)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context ".find with id" do
|
23
|
+
it "find all escrows" do
|
24
|
+
escrow_id = "78627"
|
25
|
+
stub_request(:get, "https://test.crowdpay.com/Crowdfunding/api/Escrows/#{escrow_id}")
|
26
|
+
.to_return status: 200, body: FactoryGirl.attributes_for(:escrow).to_json
|
27
|
+
escrow = CrowdPay::Escrow.find(escrow_id)
|
28
|
+
expect(escrow).to be_an(CrowdPay::Escrow)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context ".find_with_transactions" do
|
33
|
+
it "find escrows transactions" do
|
34
|
+
escrow_id = "78627"
|
35
|
+
stub_request(:get, "https://test.crowdpay.com/Crowdfunding/api/Escrows/#{escrow_id}/Transactions")
|
36
|
+
.to_return status: 200, body: FactoryGirl.attributes_for(:escrow, :with_transactions).to_json
|
37
|
+
|
38
|
+
escrow = CrowdPay::Escrow.find_with_transactions(escrow_id)
|
39
|
+
expect(escrow).to be_an(CrowdPay::Escrow)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :account, class: CrowdPay::Account do |a|
|
3
|
+
a.portal_account_number "youraccountnumber"
|
4
|
+
a.investor_id 78548
|
5
|
+
a.name_1 nil
|
6
|
+
a.name_2 nil
|
7
|
+
a.name_3 nil
|
8
|
+
a.name_4 nil
|
9
|
+
a.mailing_address_1 "123 Ave A"
|
10
|
+
a.mailing_address_2 nil
|
11
|
+
a.mailing_city "Somewhere"
|
12
|
+
a.mailing_state "TX"
|
13
|
+
a.mailing_zip "79109"
|
14
|
+
a.mailing_country nil
|
15
|
+
a.is_mailing_address_foreign "true"
|
16
|
+
a.is_cip_satisfied "true"
|
17
|
+
a.draft_account_type_id 1
|
18
|
+
a.draft_routing_number "111310870"
|
19
|
+
a.draft_account_number "1234567890"
|
20
|
+
a.draft_account_name "First Last"
|
21
|
+
a.status_id 1
|
22
|
+
a.account_type_id 12
|
23
|
+
a.w9_code_id 1
|
24
|
+
a.contact_name "InvestorFirst InvestorLast"
|
25
|
+
a.contact_phone "8061234567"
|
26
|
+
a.contact_email "fi+rst.l+ast@somewhere.com"
|
27
|
+
a.idology_id 123456
|
28
|
+
a.created_by_ip_address '182.156.77.154'
|
29
|
+
end
|
30
|
+
|
31
|
+
trait :with_assets do
|
32
|
+
after(:build) do |account|
|
33
|
+
account.assets = [FactoryGirl.build(:asset)]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
trait :with_transactions do
|
38
|
+
after(:build) do |account|
|
39
|
+
account.transactions = [FactoryGirl.build(:transaction)]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :escrow, class: CrowdPay::Escrow do |i|
|
3
|
+
i.issue_number "2000009"
|
4
|
+
i.portal_issue_number nil
|
5
|
+
i.offering_type "Debt"
|
6
|
+
i.minimum_investment_amount 20.0
|
7
|
+
i.maximum_investment_amount 10000.0
|
8
|
+
i.issue_amount 1000000
|
9
|
+
i.cash_balance 200
|
10
|
+
i.principal_balance 100
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :investor, :class => CrowdPay::Investor do |i|
|
3
|
+
i.tax_id_number { s = Time.now.to_i.to_s; s[0] = ''; s; }
|
4
|
+
i.first_name "Investor First"
|
5
|
+
i.middle_name "Investor Middle"
|
6
|
+
i.last_name "Investor Last"
|
7
|
+
i.name nil
|
8
|
+
i.birth_date Date.today() - 30.years
|
9
|
+
i.mailing_address_1 "123 Ave A"
|
10
|
+
i.mailing_address_2 nil
|
11
|
+
i.mailing_city "Somewhere"
|
12
|
+
i.mailing_state "TX"
|
13
|
+
i.mailing_zip "79109"
|
14
|
+
i.mailing_country nil
|
15
|
+
i.is_mailing_address_foreign "false"
|
16
|
+
i.legal_address_1 "123 Ave A"
|
17
|
+
i.legal_address_2 nil
|
18
|
+
i.legal_city "Somewhere"
|
19
|
+
i.legal_state "TX"
|
20
|
+
i.legal_zip "79109"
|
21
|
+
i.legal_country nil
|
22
|
+
i.is_legal_address_foreign "false"
|
23
|
+
i.primary_phone "1112223333"
|
24
|
+
i.secondary_phone "2223334444"
|
25
|
+
i.is_person "true"
|
26
|
+
i.email "cgrimes@qwinixtech.com"
|
27
|
+
i.is_cip_satisfied "false"
|
28
|
+
i.portal_investor_number "yourinvestornumber"
|
29
|
+
i.created_by_ip_address '182.156.77.154'
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :transaction, class: CrowdPay::Transaction do |t|
|
3
|
+
t.id 6829651
|
4
|
+
t.account_id 81690
|
5
|
+
t.asset_id 471277
|
6
|
+
t.date "2015-01-02T00:00:00"
|
7
|
+
t.reference "ref321"
|
8
|
+
t.description "Purchase Assets"
|
9
|
+
t.amount 250
|
10
|
+
t.status "Pending"
|
11
|
+
t.created_by_ip_address '182.156.77.154'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,105 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :verification, class: CrowdPay::Verification do |v|
|
3
|
+
v.firstName 'Investor First'
|
4
|
+
v.lastName 'Investor Middle'
|
5
|
+
v.address 'my address'
|
6
|
+
v.city 'atlanta'
|
7
|
+
v.state 'GA'
|
8
|
+
v.zip '53665'
|
9
|
+
v.taxpayerId '112223333'
|
10
|
+
v.birthMonth 2
|
11
|
+
v.birthDay 19
|
12
|
+
v.birthYear 1989
|
13
|
+
v.created_by_ip_address '182.156.77.154'
|
14
|
+
end
|
15
|
+
|
16
|
+
trait :pass do
|
17
|
+
id '1254778630'
|
18
|
+
key 'id.success'
|
19
|
+
message 'Pass'
|
20
|
+
end
|
21
|
+
|
22
|
+
trait :fail do
|
23
|
+
id '1211436364'
|
24
|
+
key 'id.failure'
|
25
|
+
message 'FAIL'
|
26
|
+
request_data { { taxpayerId: '112223333' }.to_s }
|
27
|
+
qualifiers [
|
28
|
+
{
|
29
|
+
'Key' => 'resultcode.mob.does.not.match',
|
30
|
+
'Message' => 'MOB Does Not Match'
|
31
|
+
}
|
32
|
+
]
|
33
|
+
end
|
34
|
+
|
35
|
+
trait :hard_fail do
|
36
|
+
fail
|
37
|
+
end
|
38
|
+
|
39
|
+
trait :soft_fail do
|
40
|
+
fail
|
41
|
+
|
42
|
+
questions [
|
43
|
+
{
|
44
|
+
'Prompt' => 'In which county have you lived?',
|
45
|
+
'Type' => 'current.county.b',
|
46
|
+
'Choices' => [
|
47
|
+
{ 'Text' => 'GUERNSEY' },
|
48
|
+
{ 'Text' => 'FULTON' },
|
49
|
+
{ 'Text' => 'ALCONA' },
|
50
|
+
{ 'Text' => 'None of the above' },
|
51
|
+
{ 'Text' => 'Skip Question' }
|
52
|
+
]
|
53
|
+
},
|
54
|
+
{
|
55
|
+
'Prompt' => 'From whom did you purchase the property at 222333 PEACHTREE PLACE?',
|
56
|
+
'Type' => 'purchased.property.from',
|
57
|
+
'Choices' => [
|
58
|
+
{ 'Text' => 'JOE ANDERSON' },
|
59
|
+
{ 'Text' => 'ERIC WALTORS' },
|
60
|
+
{ 'Text' => 'A VIRAY' },
|
61
|
+
{ 'Text' => 'None of the above' },
|
62
|
+
{ 'Text' => 'Skip Question' }
|
63
|
+
]
|
64
|
+
},
|
65
|
+
{
|
66
|
+
'Prompt' => 'In which city is ANY STREET?',
|
67
|
+
'Type' => 'city.of.residence',
|
68
|
+
'Choices' => [
|
69
|
+
{ 'Text' => 'ATLANTA' },
|
70
|
+
{ 'Text' => 'ALMO' },
|
71
|
+
{ 'Text' => 'PAULDING' },
|
72
|
+
{ 'Text' => 'None of the above' },
|
73
|
+
{ 'Text' => 'Skip Question' }
|
74
|
+
]
|
75
|
+
},
|
76
|
+
{
|
77
|
+
'Prompt' => 'Between 1979 and 1980, in which State did you live?',
|
78
|
+
'Type' => 'prior.residence.state.multiyear',
|
79
|
+
'Choices' => [
|
80
|
+
{ 'Text' => 'KENTUCKY' },
|
81
|
+
{ 'Text' => 'NEW YORK' },
|
82
|
+
{ 'Text' => 'MARYLAND' },
|
83
|
+
{ 'Text' => 'None of the above' },
|
84
|
+
{ 'Text' => 'Skip Question' }
|
85
|
+
]
|
86
|
+
}
|
87
|
+
]
|
88
|
+
end
|
89
|
+
|
90
|
+
trait :answers_pass do
|
91
|
+
id '1265185524'
|
92
|
+
key 'result.questions.0.incorrect'
|
93
|
+
message 'All answers correct'
|
94
|
+
summary 'pass'
|
95
|
+
request_data { { id: '1234567890', answers: [] }.to_s }
|
96
|
+
end
|
97
|
+
|
98
|
+
trait :answers_fail do
|
99
|
+
id '1265411516'
|
100
|
+
key 'result.questions.3.incorrect'
|
101
|
+
message 'Three Incorrect Answers'
|
102
|
+
summary 'fail'
|
103
|
+
request_data { { id: '1234567890', answers: [] }.to_s }
|
104
|
+
end
|
105
|
+
end
|