plangrade-ruby 0.3.13 → 0.3.14

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
  SHA1:
3
- metadata.gz: abf2848621fea4d50e4e254eed13af563802406b
4
- data.tar.gz: 7a9988f8b4af2b4f129e605ed2a6a4bdbd906349
3
+ metadata.gz: 7280294750f1d78e2b896c370643d631927a977b
4
+ data.tar.gz: 71543908067a133cc206d8c9ae77abb53b2f8178
5
5
  SHA512:
6
- metadata.gz: 7b333ff4978d24c729102b0acb9c2a3449139d7d7f991756c85ca21d4e29e133c508f2f2bc112f9db4e02c9548f1b7d24825f8b9bc41e5a4a0a9db4d87dbba47
7
- data.tar.gz: da7ee4d9e844842cd0d4c16ab92ea177aca7234dfb597b552f39103514a412f26f1bb8f558efcb34d22a73f5e4e24af73eee7a410976e3e8ad87cff1ed5f371b
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, ssn, email, phone, employee_id)
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
- def initialize(attributes)
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
- return nil unless result.success?
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
- result = api_handler.all_companies(opts)
21
+ api_handler.all_companies(opts)
29
22
  else
30
- result = api_handler.all_companies
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
- def self.create(company_id, first_name, last_name, street1, street2, city, state, zip, dob, ssn, email, phone, employee_id)
6
- 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,
7
- :zip => zip, :dob => dob, :ssn => ssn, :email => email, :phone => phone, :employee_id => employee_id)
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
- return nil unless result.success?
18
- new(result.body[:participant])
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
- result = api_handler.all_participants(opts)
25
- new(result.body[:participants])
29
+ api_handler.all_participants(opts)
26
30
  end
27
31
 
28
32
  def archive!
@@ -1,5 +1,5 @@
1
1
  module Plangrade
2
2
  module Ruby
3
- VERSION = "0.3.13"
3
+ VERSION = "0.3.14"
4
4
  end
5
5
  end
@@ -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", "1234", "compliance@plangrade.com", 123456789, 0)
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plangrade-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Reynoso
metadata.gz.sig CHANGED
Binary file