plangrade-ruby 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -3
- data.tar.gz.sig +0 -0
- data/.travis.yml +0 -1
- data/README.md +50 -4
- data/lib/plangrade/resources/company.rb +12 -0
- data/lib/plangrade/resources/participant.rb +21 -7
- data/lib/plangrade/ruby/version.rb +1 -1
- 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: cc572cab1e6af8ce319b06155cf5b6edd1b5f352
|
4
|
+
data.tar.gz: 310463d189fc5303354684acbc3d46325410019a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ce5f3d654cf231b1bbdf6b372c510aed155a62bf5e893dc88b198835998e7aba088e69c94cc35fb84a9f22057467824c32438675c78fdd101fdcbb09bf5a660
|
7
|
+
data.tar.gz: 77bf79a9c3d654df0e5ad41dcd175b91cc406703bae7713422dbdf6ecfded2d23ef5c4986efac101954b23f1f701d3ee4cc7f0e5ead6d2d5b7cb196a4701a77e
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
|
2
|
-
�o����!ma<�
|
3
|
-
Y�m�J�� ������}8�tw6<o���"�/9��G���(�B�V�.��-!�f��9�~w�I�H�7����(O�/[���v���M
|
1
|
+
���M�ު�����j��e�������փl�2,ѓ%����C|�dHMe�����i�/�y�@���G%�[-ګ}�3�s���|�7�DJ��.��[��U��#�;W}�%�"C������=J��� ��L��j�z�~�]�I��g���2�yS��U�����i3�����]���r���|*Ӟ[��o�8,cW���S�';�C6��A|�D�p�N��u���ZD� ��S�-/�S/o��Z��S�g�B�T+�
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# plangrade API Gem
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/plangrade-ruby.svg)](http://badge.fury.io/rb/plangrade-ruby)
|
3
3
|
[![Code Climate](https://codeclimate.com/github/topherreynoso/plangrade-ruby/badges/gpa.svg)](https://codeclimate.com/github/topherreynoso/plangrade-ruby)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/topherreynoso/plangrade-ruby/badge.png?branch=master)](https://coveralls.io/r/topherreynoso/plangrade-ruby?branch=master)
|
5
|
+
[![Build Status](https://travis-ci.org/topherreynoso/plangrade-ruby.svg?branch=master)](https://travis-ci.org/topherreynoso/plangrade-ruby)
|
4
6
|
|
5
7
|
Ruby wrapper for the plangrade API.
|
6
8
|
|
@@ -103,10 +105,11 @@ At this point the `access_token` is nil. This will need to be set and, in the ne
|
|
103
105
|
|
104
106
|
## Usage
|
105
107
|
|
106
|
-
This gem offers
|
108
|
+
This gem offers three ways to interact with plangrade's API:
|
107
109
|
|
108
|
-
1. Calling methods on `Plangrade` module.
|
109
|
-
2. Calling methods on an instance of `Plangrade::Client`.
|
110
|
+
1. Calling methods on `Plangrade` module. (Returns an API response)
|
111
|
+
2. Calling methods on an instance of `Plangrade::Client`. (Returns an API response)
|
112
|
+
3. Calling methods on the custom object models. (Returns identity mapped objects)
|
110
113
|
|
111
114
|
### Calling methods on the plangrade module
|
112
115
|
|
@@ -230,6 +233,50 @@ Delete participant
|
|
230
233
|
plangrade.delete_participant(id)
|
231
234
|
```
|
232
235
|
|
236
|
+
### Using the object models
|
237
|
+
|
238
|
+
The object model is an abstraction that makes it easy to manipulate the JSON data return when accessing plangrade's API. Each model has accessor methods for all keys contained in the JSON response for a given model type.
|
239
|
+
|
240
|
+
**Users**
|
241
|
+
|
242
|
+
```ruby
|
243
|
+
user_id = Plangrade::Resources::User.create(user_email_here, user_name_here)
|
244
|
+
user = Plangrade::Resouces::User.current_user
|
245
|
+
user.name
|
246
|
+
user.email
|
247
|
+
user.update!(:email => "compliance@plangrade.com")
|
248
|
+
user.delete!
|
249
|
+
```
|
250
|
+
|
251
|
+
**Companies**
|
252
|
+
|
253
|
+
```ruby
|
254
|
+
company_id = Plangrade::Resources::Company.create(company_ein_here, company_name_here)
|
255
|
+
companies = Plangrade::Resources::Company.all
|
256
|
+
company = Plangrade::Resources::Company.get(company_id)
|
257
|
+
company.name
|
258
|
+
company.ein
|
259
|
+
company.grade
|
260
|
+
company.update!(:name => "plangrade, llc")
|
261
|
+
company.delete!
|
262
|
+
```
|
263
|
+
|
264
|
+
**Patricipants**
|
265
|
+
```ruby
|
266
|
+
participants = Plangrade::Resources::Participant.all
|
267
|
+
participant_id = Plangrade::Resources::Participant.create(company_id, first_name, last_name,
|
268
|
+
street1, street2, city, state, zip,
|
269
|
+
dob, ssn, email, phone, employee_id)
|
270
|
+
participant = Plangrade::Resources::Participant.get(participant_id)
|
271
|
+
participant.first_name
|
272
|
+
participant.last_name
|
273
|
+
participant.company_id
|
274
|
+
...
|
275
|
+
participant.update!(:first_name => "Johnny")
|
276
|
+
participant.archive!
|
277
|
+
participant.delete!
|
278
|
+
```
|
279
|
+
|
233
280
|
## Supported Ruby Versions
|
234
281
|
|
235
282
|
This library aims to support and is [tested against](https://travis-ci.org/topherreynoso/plangrade-ruby) the following Ruby versions:
|
@@ -237,7 +284,6 @@ This library aims to support and is [tested against](https://travis-ci.org/tophe
|
|
237
284
|
1. Ruby 1.9.3
|
238
285
|
2. Ruby 2.0.0
|
239
286
|
3. Ruby 2.1.0
|
240
|
-
4. jruby
|
241
287
|
|
242
288
|
This library may inadvertently work (or seem to work) on other Ruby implementations, however, support will only be provided for the versions listed above.
|
243
289
|
|
@@ -11,6 +11,18 @@ module Plangrade
|
|
11
11
|
|
12
12
|
attr_accessor_deffered :name, :ein, :grade
|
13
13
|
|
14
|
+
def self.get(id)
|
15
|
+
api_handler.get_company(id)
|
16
|
+
return nil unless result.success?
|
17
|
+
new(result.body[:company])
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.all(params)
|
21
|
+
api_handler.all_companies(params)
|
22
|
+
return nil unless result.success?
|
23
|
+
new(result.body[:companies])
|
24
|
+
end
|
25
|
+
|
14
26
|
def update!(params)
|
15
27
|
api_handler.update_company(@id, params)
|
16
28
|
end
|
@@ -3,18 +3,32 @@ module Plangrade
|
|
3
3
|
class Participant < Plangrade::Resources::Base
|
4
4
|
|
5
5
|
def self.create(company_id, first_name, last_name, street1, street2, city, state, zip, dob, ssn, email, phone, employee_id)
|
6
|
-
|
7
|
-
|
8
|
-
:street1 => street1, :street2 => street2, :city => city, :state => state,
|
9
|
-
:zip => zip, :dob => dob, :ssn => ssn, :email => email, :phone => phone,
|
10
|
-
:employee_id => 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)
|
11
8
|
return nil unless result.created?
|
12
9
|
id = result.headers[:location].split('/').last.to_i
|
13
10
|
new(:id => id)
|
14
11
|
end
|
15
12
|
|
16
|
-
attr_accessor_deffered :company_id, :employee_id, :first_name, :last_name, :street1, :street2, :city, :state, :zip,
|
17
|
-
|
13
|
+
attr_accessor_deffered :company_id, :employee_id, :first_name, :last_name, :street1, :street2, :city, :state, :zip, :dob, :email, :phone
|
14
|
+
|
15
|
+
def self.get(id)
|
16
|
+
api_handler.get_participant(id)
|
17
|
+
return nil unless result.success?
|
18
|
+
new(result.body[:participant])
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.all(params)
|
22
|
+
api_handler.all_participants(params)
|
23
|
+
return nil unless result.success?
|
24
|
+
new(result.body[:participants])
|
25
|
+
end
|
26
|
+
|
27
|
+
def archive!
|
28
|
+
api_handler.archive_participant(@id)
|
29
|
+
return nil unless result.success?
|
30
|
+
new(result.body)
|
31
|
+
end
|
18
32
|
|
19
33
|
def update!(params)
|
20
34
|
api_handler.update_participant(@id, params)
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|