lockstep_rails 0.3.54 → 0.3.56

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
  SHA256:
3
- metadata.gz: 31ab22d7d4351c3b1f713fb1efe03a5bbd97f13dc314e9e31787a011bd409ec5
4
- data.tar.gz: 588543fd4a2733d41214ceeeaeb66048ba5343e438d4cc53523d824bd6e84c57
3
+ metadata.gz: f004f3fc636bc3aa132570664bd8536bcd2143204f6234e71be19876027cf8a2
4
+ data.tar.gz: 58753bea6eddae06522c57dc92af31a4a7cd715805142fc78731d8f5ad2f11ab
5
5
  SHA512:
6
- metadata.gz: c2355b5a47e7eb3f0e668ca4e13b8f71a89d26357c81309bee335b0cb6e0f1f20372372876c8ae95eba715101f3dd9945797c88cf024b47b277d5ff10bd8aaca
7
- data.tar.gz: a35c3c45c171d1e64edba696ec00f1c343fe1e82307fc87450b2ce31b0da39c427e10f8d1a8317dc4d7b755a0afdf22644413be3b21657b3d9292ee264c1ce6a
6
+ metadata.gz: a0fce44761660638e91efd5aa5b183e22ff1772bea8d6fa3ba462fce23a4c684b385f72529858cbc5a0a3058b5d30754aa89389e4d394e6496794bc12f13b326
7
+ data.tar.gz: d67c11238d5936c4e6af3b65e88e226ca11908f03220101e9f442f6cc7ca91f6402dc154adc2bdd0ebec75ae7bafb06640ab51614e5f8700e43f2b87b2706fbc
data/README.md CHANGED
@@ -52,6 +52,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
52
52
  * Lockstep::MagicLink
53
53
  * Lockstep::Note
54
54
  * Lockstep::Payments
55
+ * Lockstep::PaymentApplied
55
56
  * Lockstep::PaymentSummary
56
57
  * Lockstep::ReportApAgingHeader
57
58
  * Lockstep::ReportArAgingHeader
@@ -729,7 +729,6 @@ module Lockstep
729
729
  put_attrs = @unsaved_attributes
730
730
 
731
731
  put_attrs = relations_for_saving(put_attrs)
732
-
733
732
  put_attrs.delete(id_ref)
734
733
  put_attrs.delete('created')
735
734
  put_attrs.delete('modified')
@@ -92,6 +92,12 @@ class Lockstep::Query
92
92
  end
93
93
  end
94
94
 
95
+ def with_count(value)
96
+ with_clone do
97
+ criteria[:with_count] = value
98
+ end
99
+ end
100
+
95
101
  # attr: {customer_name: :desc}
96
102
  def order(*attr)
97
103
  with_clone do
@@ -242,13 +248,21 @@ class Lockstep::Query
242
248
  else
243
249
  results = parsed_response.is_a?(Array) ? parsed_response : parsed_response["records"]
244
250
  return [] if results.blank?
245
-
246
251
  results = results[0..(criteria[:limit] - 1)] if criteria[:limit]
247
- get_relation_objects results.map { |r|
252
+ records = get_relation_objects results.map { |r|
248
253
  # Convert camelcase to snake-case
249
254
  r = r.transform_keys { |key| key.underscore }
250
255
  @klass.model_name.to_s.constantize.new(r, false)
251
256
  }
257
+
258
+ if criteria[:with_count]
259
+ {
260
+ records: records,
261
+ total_count: parsed_response["totalCount"]
262
+ }
263
+ else
264
+ records
265
+ end
252
266
  end
253
267
  end
254
268
 
@@ -0,0 +1,16 @@
1
+ class Lockstep::PaymentApplied < Lockstep::ApiRecord
2
+ self.model_name_uri = "v1/payments-applied"
3
+ self.id_ref = "payment_applied_id"
4
+ self.query_path = ""
5
+ load_schema(Schema::PaymentApplied)
6
+
7
+ def self.merge_all_attributes(objects, response)
8
+ objects.each_with_index do |item, index|
9
+ next unless response[index]
10
+
11
+ new_attributes = response[index].transform_keys { |key| key.underscore }
12
+ end
13
+
14
+ true
15
+ end
16
+ end
@@ -1,7 +1,28 @@
1
1
  class Lockstep::ServiceFabricPayment < Lockstep::ApiRecord
2
2
  self.model_name_uri = "v1/payments-acceptance/payments/"
3
- self.id_ref = "end_to_end_identifier"
3
+ self.id_ref = ""
4
4
  self.query_path=""
5
5
  load_schema(Schema::SfPaymentRequest)
6
6
 
7
+ # Preventing deletion of id_ref from puts_attrs because
8
+ # id_ref column is required to send in body in case of
9
+ # create ServiceFabricPayment
10
+ # TODO: Make it generic
11
+ def attributes_for_saving
12
+ @unsaved_attributes = pointerize(@unsaved_attributes)
13
+ put_attrs = @unsaved_attributes
14
+
15
+ put_attrs = relations_for_saving(put_attrs)
16
+ put_attrs.delete('created')
17
+ put_attrs.delete('modified')
18
+ put_attrs
19
+ end
20
+
21
+ # Overriding This method to not send body inside an Array
22
+ def create
23
+ attrs = attributes_for_saving.transform_keys { |key| key.camelize(:lower) }
24
+ resp = resource.post('', body: attrs)
25
+ result = post_result(resp)
26
+ end
27
+
7
28
  end
@@ -1,3 +1,3 @@
1
1
  module LockstepRails
2
- VERSION = '0.3.54'
2
+ VERSION = '0.3.56'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockstep_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.54
4
+ version: 0.3.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vivek AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-16 00:00:00.000000000 Z
11
+ date: 2023-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -60,6 +60,7 @@ files:
60
60
  - app/models/lockstep/magic_link.rb
61
61
  - app/models/lockstep/note.rb
62
62
  - app/models/lockstep/payment.rb
63
+ - app/models/lockstep/payment_applied.rb
63
64
  - app/models/lockstep/payment_summary.rb
64
65
  - app/models/lockstep/report_ap_aging_header.rb
65
66
  - app/models/lockstep/report_ar_aging_header.rb