openapply 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ea03a8e3bcfc34624d8c592e83d579600f62e323f00b5fbd563b3ef1b22616b
4
- data.tar.gz: 915c89ae39776eb48b0d0533f6ba63b496cad6efb83ffa83d6f9f62ddfad983b
3
+ metadata.gz: d4ffbf0a9625607d27742d3d8eab1ab57802ce0f27dbfbb2ef2c5b52ec5da8d3
4
+ data.tar.gz: 457741241de4a8bf32e53feb790772a96393382934d1d7808d6c7b0cb10866aa
5
5
  SHA512:
6
- metadata.gz: 860ecaf7e6d4ad6255edd1785f30c8e51b1dfee12de0747efa78c264d71e2f39983ae46ef31938785455ed0822ef23fc5f946ebf2d0eb950f1cb03e803466afc
7
- data.tar.gz: 926f34f47b262ac63786edafbdbd62af3dc7ba3b786d36a26d9180c3404d2f907f74e7ec18247a2a150897eb3bc6e2d97f3fd108faaf0aea1b72ab18aba98723
6
+ metadata.gz: 60cd8ca6032a0f1e265eaf55e620432b8854d4e72e685235c7acaf5041a452d8506937db2da40ca038f23334a1a3b7491e0617d3df2f9bd998334c8bcbd03962
7
+ data.tar.gz: 9bcf4a9a22033330c1a4f4a168b9a33afcb1dbbff07ae29c616f0bb12cca68ee8c5f2aab2558d4c5aa620b799490341b26fb5e444be255301f4ce5da8f983471
data/README.md CHANGED
@@ -5,19 +5,24 @@ This gem allows ruby access to the OpenApply API v1 - and supports the GET featu
5
5
 
6
6
  ### Still TODO
7
7
 
8
- * write PUTS methods
9
- * write a recursive custom query
10
- * speed response when returning large number of records
11
- * allow flattening and reject to work at any depth (recursion?)
8
+ * allow csv and xlsx reports with default summary info only?
9
+ * write PUTS methods - *currently api only allows status update*
10
+ * allow flattening and reject to work at any depth (with recursion?)
11
+ * write a recursive custom query - when results are more than one page
12
+ * speed up response when returning large number of records? - **looks like API is slow not sure if this can be sped up**
12
13
 
13
14
 
14
15
  ### CHANGE LOG
15
16
 
16
- * **v0.2.2** - update compatible with 0.2.x - 2017-11-21
17
+ * **v0.2.3** - compatible with 0.2.x - 2017-11-23
18
+ - allow detailed queries *(_by_id & _by_status)* to skip payment information
19
+ - allow array, csv & xlsx transformations to skip payment queries (when no payment_info requested)
20
+
21
+ * **v0.2.2** - compatible with 0.2.x - 2017-11-21
17
22
  - refactor and test url timeouts
18
23
  - refactor openapply client
19
24
 
20
- * **v0.2.1** - update compatible with 0.2.x - 2017-11-20
25
+ * **v0.2.1** - compatible with 0.2.x - 2017-11-20
21
26
  - convert api data into an array, csv or xlsx
22
27
  - allow data flattening prep for post processing
23
28
  - allow queries to lookup students with multiple statuses
@@ -115,6 +120,9 @@ Associates the above settings with HTTParty
115
120
  # ATTRIBUTES: id, [:keys_to_un-nest], [:keys_to_exclude]
116
121
  @oa.student_details_by_id(95)
117
122
  @oa.student_details_by_id(95, [:custom_fields], [:parent_guardian])
123
+ # skip payment info -- (payments: [])
124
+ @oa.student_details_by_id(95, [], [], false)
125
+ @oa.student_details_by_id(95, [:custom_fields], [:parent_guardian], false)
118
126
  #
119
127
  # student summaries of a given status (recursively if more than on page)
120
128
  @oa.students_by_status('applied')
@@ -122,13 +130,20 @@ Associates the above settings with HTTParty
122
130
  # student details of a given status (recursively if more than on page)
123
131
  @oa.students_details_by_status('applied')
124
132
  @oa.students_details_by_status('applied', [:custom_fields])
125
- @oa.students_details_by_status('applied', nil, [:parent_guardian])
133
+ @oa.students_details_by_status('applied', [], [:parent_guardian])
126
134
  @oa.students_details_by_status('applied', [:custom_fields], [:parent_guardian])
135
+ # skip payment info (payments: [])
136
+ @oa.students_details_by_status('applied', [], [], false)
137
+ @oa.students_details_by_status('applied', [:custom_fields], [:parent_guardian], false)
127
138
  #
128
139
  # student details with multiple status (recursively if more than on page)
129
140
  @oa.students_details_by_statuses(['applied','enrolled'], [:custom_fields])
130
141
  @oa.students_details_by_statuses(['applied','enrolled'], nil, [:parent_guardian])
131
142
  @oa.students_details_by_statuses(['applied','enrolled'], [:custom_fields], [:parent_guardian])
143
+ # speed up and skip payment info - returns [] in payment area
144
+ @oa.students_details_by_statuses(['applied','enrolled'], [], [], false)
145
+ # speed up and skip payment info - returns [] in payment area
146
+ @oa.students_details_by_statuses(['applied','enrolled'], [:custom_fields], [:parent_guardian], false)
132
147
  #
133
148
  # create an array
134
149
  @oa.students_as_array_by_status('applied', [:custom_fields], [:parent_guardian], [:id, :name], {count: 1, keys: [:id, :name, :address]}, {count: 2, order: :newest, keys: [:date, :amount]} )
@@ -1,7 +1,9 @@
1
1
  ## Usage
2
- Start irb
2
+
3
+ In the terminal:
4
+
3
5
  ```bash
4
- bundle install
6
+ gem install openapply
5
7
 
6
8
  # irb
7
9
  # or
@@ -29,10 +29,14 @@ module Convert
29
29
  guardian_info={}, payment_info={})
30
30
  #
31
31
  check = check_details_keys_validity(flatten_keys, reject_keys)
32
- return check unless check.nil? # or check[:error].nil?
32
+ return check unless check.nil? # or check[:error].nil?
33
33
  #
34
+ # by default get payment info (unless no payment info is requested)
35
+ get_payments = true
36
+ get_payments = false if payment_info.nil? or payment_info.empty?
37
+ # go get student details from api
34
38
  students_hash = students_details_by_status( status,
35
- flatten_keys, reject_keys)
39
+ flatten_keys, reject_keys, get_payments )
36
40
  #
37
41
  students_array = students_hash_to_array( students_hash,
38
42
  student_keys, guardian_info, payment_info)
@@ -65,7 +69,7 @@ module Convert
65
69
  guardian_info={}, payment_info={})
66
70
  #
67
71
  check = check_details_keys_validity(flatten_keys, reject_keys)
68
- return check unless check.nil? # or check[:error].nil?
72
+ return check unless check.nil? # or check[:error].nil?
69
73
  # check = check_header_keys_validity(student_keys, guardian_info, payment_info)
70
74
  # return check unless check.nil?
71
75
  #
@@ -73,7 +77,7 @@ module Convert
73
77
  flatten_keys, reject_keys,
74
78
  student_keys, guardian_info, payment_info )
75
79
  #
76
- return students_array if students_array.is_a? Hash
80
+ return students_array if students_array.is_a? Hash
77
81
  #
78
82
  student_csv_txt = students_array_to_csv( students_array )
79
83
  end
@@ -121,7 +125,7 @@ module Convert
121
125
  guardian_info={}, payment_info={})
122
126
  #
123
127
  check = check_details_keys_validity(flatten_keys, reject_keys)
124
- return check unless check.nil? # or check[:error].nil?
128
+ return check unless check.nil? # or check[:error].nil?
125
129
  # check = check_header_keys_validity(student_keys, guardian_info, payment_info)
126
130
  # return check unless check.nil?
127
131
  #
@@ -129,7 +133,7 @@ module Convert
129
133
  flatten_keys, reject_keys,
130
134
  student_keys, guardian_info, payment_info )
131
135
  #
132
- return students_array if students_array.is_a? Hash
136
+ return students_array if students_array.is_a? Hash
133
137
  #
134
138
  students_xlsx = students_array_to_xlsx( students_array )
135
139
 
@@ -51,6 +51,13 @@ module Get
51
51
  # * +flatten_keys+ - an array of keys to bring to the top level
52
52
  # (with this key prepened) -- default (blank does nothing)
53
53
  # * +reject_keys+ - an array of keys to remove from the data -- default (blank does nothing)
54
+ # * +get_payments+ - default is true (but needs double lookup) - faster when false!
55
+ #
56
+ # === Usage
57
+ # students_details_by_id(95)
58
+ # students_details_by_id(95, [], [], false)
59
+ # students_details_by_id(95, [:custom_fields], [:parent_guardian])
60
+ # students_details_by_id(95, [:custom_fields], [:parent_guardian], false)
54
61
  #
55
62
  # === Returned Data
56
63
  # returns the data structured as:
@@ -61,7 +68,7 @@ module Get
61
68
  # payments: [ {} ] # all payments made via openapply
62
69
  # }
63
70
  # }
64
- def student_details_by_id(id, flatten_keys=[], reject_keys=[])
71
+ def student_details_by_id(id, flatten_keys=[], reject_keys=[], get_payments=true)
65
72
 
66
73
  check = check_details_keys_validity(flatten_keys, reject_keys)
67
74
  return check unless check.nil? # or check[:error].nil?
@@ -69,7 +76,7 @@ module Get
69
76
  # get full student record and guardian information
70
77
  student_info = student_by_id( "#{id}" )
71
78
  # get student payment records
72
- payment_info = payments_by_id( "#{id}" )
79
+ payment_info = payments_by_id( "#{id}" ) if get_payments.eql? true
73
80
 
74
81
  # be sure there is student data to process -- if not return an empty record
75
82
  return {student: {id: id, empty: []}} if student_info.nil? or
@@ -10,16 +10,20 @@ module Get
10
10
  #
11
11
  # === Attributes
12
12
  #
13
- # **flatten_keys** - brings these keys to the top level - prepending the group name to the key name -- we usually use:
13
+ # +flatten_keys+ - brings these keys to the top level - prepending the group name to the key name -- we usually use:
14
14
  # flatten_keys = [:custom_fields]
15
- # **reject keys** -- removes the data matching these keys -- we usually use:
15
+ # +reject keys+ -- removes the data matching these keys -- we usually use:
16
16
  # reject_keys = [:parent_guardian] (since this is duplicated)
17
+ # * +get_payments+ - default is true (but needs double lookup) - faster when false!
17
18
  #
18
19
  # === Usage
19
20
  # students_details_by_status('applied')
21
+ # students_details_by_status('applied', [], [],false)
20
22
  # students_details_by_status('applied', [:custom_fields], [:parent_guardian])
23
+ # students_details_by_status('applied', [:custom_fields], [:parent_guardian], false)
21
24
  # students_details_by_statuses(['applied','enrolled'])
22
25
  # students_details_by_statuses(['applied','enrolled'], [:custom_fields], [:parent_guardian])
26
+ # students_details_by_statuses(['applied','enrolled'], [:custom_fields], [:parent_guardian], false)
23
27
  #
24
28
  # === Returned Data
25
29
  # returns the data structured as:
@@ -38,7 +42,7 @@ module Get
38
42
  # }
39
43
  # ]
40
44
  # }
41
- def students_details_by_status( status, flatten_keys=[], reject_keys=[] )
45
+ def students_details_by_status( status, flatten_keys=[], reject_keys=[], get_payments=true )
42
46
 
43
47
  check = check_details_keys_validity(flatten_keys, reject_keys)
44
48
  return check unless check.nil? # or check[:error].nil?
@@ -52,7 +56,7 @@ module Get
52
56
  error_ids = []
53
57
  student_records = []
54
58
  ids[:student_ids].each do |id|
55
- student = student_details_by_id( "#{id}", flatten_keys, reject_keys )
59
+ student = student_details_by_id( "#{id}", flatten_keys, reject_keys, get_payments )
56
60
 
57
61
  error_ids << id if student.nil? or
58
62
  student[:student].nil? or
@@ -1,3 +1,3 @@
1
1
  module Openapply
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapply
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill Tihen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-21 00:00:00.000000000 Z
11
+ date: 2017-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty