plangrade-ruby 0.3.13 → 0.3.14
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +4 -1
- data/lib/plangrade/resources/company.rb +4 -14
- data/lib/plangrade/resources/participant.rb +13 -9
- data/lib/plangrade/ruby/version.rb +1 -1
- data/spec/resources/participant_spec.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7280294750f1d78e2b896c370643d631927a977b
|
4
|
+
data.tar.gz: 71543908067a133cc206d8c9ae77abb53b2f8178
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70fb70ff291ed35e1967a8fcfbf679c5f8931f945a582cf16b319f0862303f1244e0185473d758e2b079d6d7c63e8c099a4991330881ca793750ce25689a5a9d
|
7
|
+
data.tar.gz: b2f59c2d307d66cd18c1972eca7f441fcd8d32ee2f033cd001aa968e1b8cc696b46e7e635bd287f2e5770667a7ce3ae7170235897ec3b521e805d4d553913f14
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -264,9 +264,12 @@ company.delete!
|
|
264
264
|
**Patricipants**
|
265
265
|
```ruby
|
266
266
|
participants = Plangrade::Resources::Participant.all
|
267
|
+
|
268
|
+
# The last parameter in this is optional, this shows how to add it for an employee, a dependent would just omit the last
|
267
269
|
participant_id = Plangrade::Resources::Participant.create(company_id, first_name, last_name,
|
268
270
|
street1, street2, city, state, zip,
|
269
|
-
dob,
|
271
|
+
dob, email, phone, employee_id, {:ssn => employee_last_four_ssn})
|
272
|
+
|
270
273
|
participant = Plangrade::Resources::Participant.get(participant_id)
|
271
274
|
participant.first_name
|
272
275
|
participant.last_name
|
@@ -1,14 +1,8 @@
|
|
1
1
|
module Plangrade
|
2
2
|
module Resources
|
3
3
|
class Company < Plangrade::Resources::Base
|
4
|
-
attr_reader :id, :name, :ein, :grade
|
5
4
|
|
6
|
-
|
7
|
-
@id = attributes["id"]
|
8
|
-
@name = attributes["name"]
|
9
|
-
@ein = attributes["ein"]
|
10
|
-
@grade = attributes["grade"]
|
11
|
-
end
|
5
|
+
attr_accessor_deffered :name, :ein, :grade
|
12
6
|
|
13
7
|
def self.create(ein, name)
|
14
8
|
result = api_handler.create_company(:ein => ein, :name => name)
|
@@ -19,19 +13,15 @@ module Plangrade
|
|
19
13
|
|
20
14
|
def self.get(id)
|
21
15
|
result = api_handler.get_company(id)
|
22
|
-
|
23
|
-
new(result.body[:company])
|
16
|
+
new(result.body)
|
24
17
|
end
|
25
18
|
|
26
19
|
def self.all(*opts)
|
27
20
|
if opts && opts != nil && opts != {}
|
28
|
-
|
21
|
+
api_handler.all_companies(opts)
|
29
22
|
else
|
30
|
-
|
23
|
+
api_handler.all_companies
|
31
24
|
end
|
32
|
-
parsed_result = JSON.parse(result)
|
33
|
-
companies = parsed_result["companies"]
|
34
|
-
companies.map { |attributes| new(attributes) }
|
35
25
|
end
|
36
26
|
|
37
27
|
def update!(params)
|
@@ -2,27 +2,31 @@ module Plangrade
|
|
2
2
|
module Resources
|
3
3
|
class Participant < Plangrade::Resources::Base
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
attr_accessor_deffered :company_id, :employee_id, :first_name, :last_name, :street1, :street2, :city, :state, :zip, :dob, :email, :phone
|
6
|
+
|
7
|
+
def self.create(company_id, first_name, last_name, street1, street2, city, state, zip, dob, email, phone, employee_id, opts={})
|
8
|
+
if opts && !opts.nil? && opts != {}
|
9
|
+
result = api_handler.create_participant(:company_id => company_id, :first_name => first_name, :last_name => last_name, :street1 => street1, :street2 => street2, :city => city, :state => state,
|
10
|
+
:zip => zip, :dob => dob, :ssn => opts[:ssn], :email => email, :phone => phone, :employee_id => employee_id)
|
11
|
+
else
|
12
|
+
result = api_handler.create_participant(:company_id => company_id, :first_name => first_name, :last_name => last_name, :street1 => street1, :street2 => street2, :city => city, :state => state,
|
13
|
+
:zip => zip, :dob => dob, :email => email, :phone => phone, :employee_id => employee_id)
|
14
|
+
end
|
8
15
|
return nil unless result.created?
|
9
16
|
id = result.headers[:location].split('/').last.to_i
|
10
17
|
new(:id => id)
|
11
18
|
end
|
12
19
|
|
13
|
-
attr_accessor_deffered :company_id, :employee_id, :first_name, :last_name, :street1, :street2, :city, :state, :zip, :dob, :email, :phone
|
14
|
-
|
15
20
|
def self.get(id)
|
16
21
|
result = api_handler.get_participant(id)
|
17
|
-
|
18
|
-
new(
|
22
|
+
participant = result.body["participant"]
|
23
|
+
new(participant)
|
19
24
|
end
|
20
25
|
|
21
26
|
def self.all(company_id, *opts)
|
22
27
|
opts ||= {}
|
23
28
|
opts[:company_id] = company_id
|
24
|
-
|
25
|
-
new(result.body[:participants])
|
29
|
+
api_handler.all_participants(opts)
|
26
30
|
end
|
27
31
|
|
28
32
|
def archive!
|
@@ -50,7 +50,7 @@ describe Plangrade::Resources::Participant do
|
|
50
50
|
:body => '',
|
51
51
|
:headers => { 'Location' => 'https://plangrade.com/api/v1/participants/3'}
|
52
52
|
)
|
53
|
-
subject.create(1, "Johnny", "Compliance", "1234 Fake St.", "", "Fake", "UT", "12345", "1985-12-31", "
|
53
|
+
subject.create(1, "Johnny", "Compliance", "1234 Fake St.", "", "Fake", "UT", "12345", "1985-12-31", "compliance@plangrade.com", 123456789, 0, {:ssn => "1234"})
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|