lockstep_rails 0.3.62 → 0.3.64

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: 9be38b7152f518344bb64998dc99c2ffbf4e0cc2bcf8bdbede10db7bf0a753ca
4
- data.tar.gz: 5451642d8f5a986a6a568868b85734222a2b241e2f7f6d226a4652cedef7f8cb
3
+ metadata.gz: d83e57b6db6e9db14cd4f15009562ccd5d0d04efa90a70b06f5f60a58ac53f40
4
+ data.tar.gz: c4830314919f4710198deb5e2931808ed9b6533d727eb992ba4d1532473ff427
5
5
  SHA512:
6
- metadata.gz: bb9b19ccbba26424a2eb571e622f73e8dba2f1cf913969757af232577d1449f88f031e75622a3a73c1916747988e357937af97ea77f48bf90207ff58e91fa229
7
- data.tar.gz: 939add76110fce864a6fa02758e34b95124ef5db2eee221498d66266b56a11b8b9d21425a307a76cbb010ec7b9b653d401e4cf6cbfec974c94d6dd6ee06107cd
6
+ metadata.gz: 70ce01db3c9b2e45047839ab02ca21dc01f82a781c0b2489dc320931b3774c4d8c720aa2665cc142738dd6892ea92f53f708233fee0758f1a29fa14eab20a89c
7
+ data.tar.gz: 58b0d4ed3f52e6c72a1bd3d52f9b3eaf10b8cf5853e03720d9927f33fb4af2eb8e10362821cf43ea621d0d151bcf314a5975580de01b5526552e2169e506e68c
data/README.md CHANGED
@@ -166,6 +166,14 @@ if you wish, you can always write raw [Searchlight](https://developer.lockstep.i
166
166
  Lockstep::Connection.where("isActive is true OR default_currency_code in ('USD', 'INR')").execute
167
167
  ```
168
168
 
169
+ ### Destroy and Destroy all
170
+ You can destroy a single object by calling destroy method on one object
171
+ Lockstep::Connection.find(company_id: "17544da8-7be8-4ee2-8c62-cbd81428c68b").destroy
172
+
173
+ You can also destroy multiple objects at once by calling it on the model class and passing an array of relevant ids
174
+
175
+ Lockstep::Connection.destroy_all(id: ["17544da8-7be8-4ee2-8c62-cbd81428c68b"])
176
+
169
177
  ### Count
170
178
  You can fetch the count of available records by calling `count`
171
179
 
@@ -572,13 +572,6 @@ module Lockstep
572
572
  obj
573
573
  end
574
574
 
575
- # Replaced with a batch destroy_all method.
576
- # def self.destroy_all(all)
577
- # all.each do |object|
578
- # object.destroy
579
- # end
580
- # end
581
-
582
575
  def self.class_attributes
583
576
  @class_attributes ||= {}
584
577
  end
@@ -678,7 +671,8 @@ module Lockstep
678
671
  @attributes.merge!(results)
679
672
  @attributes.merge!(@unsaved_attributes)
680
673
 
681
- merge_relations
674
+ # commenting for now as its a duplicate call
675
+ # merge_relations
682
676
  @unsaved_attributes = {}
683
677
 
684
678
  create_setters_and_getters!
@@ -821,6 +815,18 @@ module Lockstep
821
815
  false
822
816
  end
823
817
 
818
+ def self.destroy_all(id: [])
819
+ id.each_slice(100) do |sliced_ids|
820
+ resp = resource.delete('', body: { 'idsToDelete' => sliced_ids })
821
+ return false unless resp.code.to_s == '200'
822
+ # TODO: Since this could fail for certain IDs return deleted_ids in batch
823
+ end
824
+
825
+ @attributes = {}
826
+ @unsaved_attributes = {}
827
+ return true
828
+ end
829
+
824
830
  def reload
825
831
  return false if new?
826
832
 
@@ -159,8 +159,8 @@ module Lockstep
159
159
  request(:put, path, body, params)
160
160
  end
161
161
 
162
- def delete(path)
163
- request(:delete, path, {}, {})
162
+ def delete(path, body: {})
163
+ request(:delete, path, body, {})
164
164
  end
165
165
 
166
166
  def post_magic_link(path, body: {}, params: {})
@@ -3,7 +3,7 @@ class Lockstep::Connection < Lockstep::ApiRecord
3
3
  self.id_ref = 'company_id'
4
4
  load_schema(Schema::Company)
5
5
 
6
- enum company_type: %w[Customer Vendor Group Company]
6
+ enum company_type: ['Customer', 'Vendor', 'Group', 'Company', 'Third Party'].freeze
7
7
 
8
8
  has_many :contacts, class_name: 'Lockstep::Contact', included: true
9
9
  belongs_to :created_user, class_name: 'Lockstep::User', foreign_key: :created_user_id, primary_key: :user_id
@@ -1,7 +1,8 @@
1
1
  class Lockstep::MagicLink < Lockstep::ApiRecord
2
2
  self.model_name_uri = "v1/useraccounts/magic-links"
3
- self.id_ref = "magicLinkId"
3
+ self.id_ref = "magic_link_id"
4
4
  self.query_path = nil
5
+ load_schema(Schema::MagicLink)
5
6
 
6
7
  def self.generate(email_id, expiry, app_id, user_role, company_id, accounting_profile_id)
7
8
  body = { email: email_id,
@@ -10,7 +10,11 @@ end
10
10
  # @format: int32
11
11
  field :timeframe
12
12
 
13
- # Amount of payments collected based in the timeframe
13
+ # The base currency code of the group.
14
+ # @type: string
15
+ field :base_currency_code
16
+
17
+ # Amount of payments collected based in the timeframe in the group's base currency
14
18
  # @type: number
15
19
  # @format: double
16
20
  field :payments_collected
@@ -20,7 +24,7 @@ end
20
24
  # @format: int32
21
25
  field :payments_collected_count
22
26
 
23
- # Amount of invoices billed based in the timeframe
27
+ # Amount of invoices billed based in the timeframe in the group's base currency
24
28
  # @type: number
25
29
  # @format: double
26
30
  field :invoices_billed
@@ -15,7 +15,7 @@ end
15
15
  # Example: If you store your company records in a database, whatever the primary key for the company table is
16
16
  # in the database should be the `ErpKey`.
17
17
  #
18
- # Example: If you use a financial system such as Quickbooks or Xero, look for the primary ID number of the
18
+ # Example: If you use a financial system such as QuickBooks or Xero, look for the primary ID number of the
19
19
  # company record within that financial system.
20
20
  #
21
21
  # For more information, see [Identity Columns](https://developer.lockstep.io/docs/identity-columns).
@@ -50,6 +50,13 @@ end
50
50
  # @type: string
51
51
  field :erp_key
52
52
 
53
+ # Possible statuses for a record that supports ERP write.
54
+ field :erp_write_status
55
+
56
+ # The name of the ErpWriteStatus for this credit memo application
57
+ # @type: string
58
+ field :erp_write_status_name
59
+
53
60
  # Reference number for the applied credit memo.
54
61
  # @type: integer
55
62
  # @format: int32
@@ -93,6 +100,11 @@ end
93
100
  # @format: uuid
94
101
  field :app_enrollment_id
95
102
 
103
+ # The date on which this record was last modified in source ERP.
104
+ # @type: string
105
+ # @format: date-time
106
+ field :source_modified_date, Types::Params::DateTime
107
+
96
108
  # The credit memo invoice associated with this applied credit memo
97
109
  field :credit_memo_invoice
98
110
 
@@ -0,0 +1,23 @@
1
+ class Schema::EmailReplyGeneratorRequest < Lockstep::ApiRecord
2
+
3
+ # ApiRecord will crash unless `id_ref` is defined
4
+ def self.id_ref
5
+ nil
6
+ end
7
+
8
+ # The date associated with the email
9
+ # @type: string
10
+ # @format: date-time
11
+ field :date, Types::Params::DateTime
12
+
13
+ # The body associated with the email
14
+ # @type: string
15
+ field :body
16
+
17
+ # The subject associated with the email
18
+ # @type: string
19
+ field :subject
20
+
21
+
22
+
23
+ end
@@ -0,0 +1,16 @@
1
+ class Schema::EmailReplyGeneratorResponse < Lockstep::ApiRecord
2
+
3
+ # ApiRecord will crash unless `id_ref` is defined
4
+ def self.id_ref
5
+ nil
6
+ end
7
+
8
+ # The id for this request in the GMS system
9
+ # @type: string
10
+ # @format: uuid
11
+ field :message_id
12
+
13
+
14
+ has_many :suggestions, {:class_name=>"Schema::EmailReplyGeneratorSuggestions", :included=>true}
15
+
16
+ end
@@ -0,0 +1,18 @@
1
+ class Schema::EmailReplyGeneratorSuggestions < Lockstep::ApiRecord
2
+
3
+ # ApiRecord will crash unless `id_ref` is defined
4
+ def self.id_ref
5
+ nil
6
+ end
7
+
8
+ # The kind of reply generated by the GMS Api
9
+ # @type: string
10
+ field :kind
11
+
12
+ # The body of the reply generated by the GMS Api
13
+ # @type: string
14
+ field :body
15
+
16
+
17
+
18
+ end
@@ -63,6 +63,13 @@ end
63
63
  # @format: double
64
64
  field :balance
65
65
 
66
+ # Financial Account Balance Types
67
+ field :balance_type
68
+
69
+ # The name of the BalanceType for this record.
70
+ # @type: string
71
+ field :balance_type_name
72
+
66
73
  # The date on which this financial account balance history record was created.
67
74
  # @type: string
68
75
  # @format: date-time
@@ -15,7 +15,7 @@ end
15
15
  # originating financial system for this record.
16
16
  # Example: If you store your company records in a database, whatever the primary key for the company table is
17
17
  # in the database should be the ErpKey.
18
- # Example: If you use a financial system such as Quickbooks or Xero, look for the primary ID number of the
18
+ # Example: If you use a financial system such as QuickBooks or Xero, look for the primary ID number of the
19
19
  # company record within that financial system.
20
20
  # @type: string
21
21
  field :financial_account_erp_key
@@ -51,6 +51,9 @@ end
51
51
  # @format: double
52
52
  field :balance
53
53
 
54
+ # The balance type of this period. If left null, the balance type will be determined by the balance.
55
+ field :balance_type
56
+
54
57
 
55
58
 
56
59
  end
@@ -226,6 +226,18 @@ end
226
226
  # @format: double
227
227
  field :base_currency_outstanding_balance_amount
228
228
 
229
+ # Possible statuses for a record that supports ERP write.
230
+ field :erp_write_status
231
+
232
+ # The name of the ErpWriteStatus for this Invoice
233
+ # @type: string
234
+ field :erp_write_status_name
235
+
236
+ # The date on which this record was last modified in source ERP.
237
+ # @type: string
238
+ # @format: date-time
239
+ field :source_modified_date, Types::Params::DateTime
240
+
229
241
  # The Company associated to this invoice.
230
242
  # To retrieve this item, specify `Company` in the "Include" parameter for your query.
231
243
  field :company
@@ -133,6 +133,18 @@ end
133
133
  # @format: uuid
134
134
  field :app_enrollment_id
135
135
 
136
+ # Possible statuses for a record that supports ERP write.
137
+ field :erp_write_status
138
+
139
+ # The name of the ErpWriteStatus for this Invoice
140
+ # @type: string
141
+ field :erp_write_status_name
142
+
143
+ # The date on which this record was last modified in source ERP.
144
+ # @type: string
145
+ # @format: date-time
146
+ field :source_modified_date, Types::Params::DateTime
147
+
136
148
  belongs_to :created_user, {:class_name=>"Lockstep::User", :primary_key=>:user_id, :foreign_key=>"created_user_id"}
137
149
  belongs_to :modified_user, {:class_name=>"Lockstep::User", :primary_key=>:user_id, :foreign_key=>"modified_user_id"}
138
150
 
@@ -0,0 +1,36 @@
1
+ class Schema::NotificationData < Lockstep::ApiRecord
2
+
3
+ # ApiRecord will crash unless `id_ref` is defined
4
+ def self.id_ref
5
+ nil
6
+ end
7
+
8
+ # The id of the subscription due to which this notification has been sent
9
+ # @type: string
10
+ field :subscription_id
11
+
12
+ # The client application identifier
13
+ # @type: string
14
+ field :application_id
15
+
16
+ # Application unique identifier for this company
17
+ # @type: string
18
+ # @format: uuid
19
+ field :external_id
20
+
21
+ # Unknown
22
+ # @type: string
23
+ field :network_id
24
+
25
+ # expirationDateTime if the subscription has one
26
+ # @type: string
27
+ # @format: date-time
28
+ field :expiration_date_time, Types::Params::DateTime
29
+
30
+ # Specific info about this event
31
+ # @type: object
32
+ field :service_attributes
33
+
34
+
35
+
36
+ end
@@ -5,12 +5,6 @@ def self.id_ref
5
5
  nil
6
6
  end
7
7
 
8
- # This model represents all the payables that are
9
- # either already due or due within this date.
10
- # @type: string
11
- # @format: date-time
12
- field :due_date, Types::Params::DateTime
13
-
14
8
  # The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
15
9
  # account will share the same GroupKey value. GroupKey values cannot be changed once created.
16
10
  #
@@ -19,19 +13,19 @@ end
19
13
  # @format: uuid
20
14
  field :group_key
21
15
 
22
- # Name for this company
23
- # @type: string
24
- field :vendor_name
16
+ # Number of bills due for this time period
17
+ # @type: integer
18
+ # @format: int32
19
+ field :number_of_bills_due
25
20
 
26
21
  # The unique Lockstep Id for the Vendor
27
22
  # @type: string
28
23
  # @format: uuid
29
24
  field :vendor_id
30
25
 
31
- # Number of bills due for this time period
32
- # @type: integer
33
- # @format: int32
34
- field :number_of_bills_due
26
+ # Name for this company
27
+ # @type: string
28
+ field :vendor_name
35
29
 
36
30
  # Primary Contact for this company
37
31
  # @type: string
@@ -51,6 +45,12 @@ end
51
45
  # @format: double
52
46
  field :total_amount_due
53
47
 
48
+ # This model represents all the payables that are
49
+ # either already due or due within this date.
50
+ # @type: string
51
+ # @format: date-time
52
+ field :due_date, Types::Params::DateTime
53
+
54
54
 
55
55
 
56
56
  end
@@ -36,6 +36,13 @@ end
36
36
  # @type: string
37
37
  field :erp_key
38
38
 
39
+ # Possible statuses for a record that supports ERP write.
40
+ field :erp_write_status
41
+
42
+ # The name of the ErpWriteStatus for this Payment
43
+ # @type: string
44
+ field :erp_write_status_name
45
+
39
46
  # The type of payment, AR Payment or AP Payment.
40
47
  #
41
48
  # Recognized PaymentType values are:
@@ -94,6 +101,10 @@ end
94
101
  # @type: string
95
102
  field :currency_code
96
103
 
104
+ # The Bank account id for the company to which this payment belongs.
105
+ # @type: string
106
+ field :bank_account_id
107
+
97
108
  # Reference code for the payment for the given Erp system.
98
109
  # @type: string
99
110
  field :reference_code
@@ -154,6 +165,11 @@ end
154
165
  # @type: string
155
166
  field :service_fabric_status
156
167
 
168
+ # The date on which this record was last modified in source ERP.
169
+ # @type: string
170
+ # @format: date-time
171
+ field :source_modified_date, Types::Params::DateTime
172
+
157
173
  belongs_to :company, {:class_name=>"Lockstep::Account", :primary_key=>:company_id, :foreign_key=>"company_id"}
158
174
  belongs_to :account, {:class_name=>"Lockstep::Account", :primary_key=>:company_id, :foreign_key=>"company_id"}
159
175
  belongs_to :created_user, {:class_name=>"Lockstep::User", :primary_key=>:user_id, :foreign_key=>"created_user_id"}
@@ -41,6 +41,13 @@ end
41
41
  # @type: string
42
42
  field :erp_key
43
43
 
44
+ # Possible statuses for a record that supports ERP write.
45
+ field :erp_write_status
46
+
47
+ # The name of the ErpWriteStatus for this payment application
48
+ # @type: string
49
+ field :erp_write_status_name
50
+
44
51
  # The entry number of this payment application. This is often a journal entry number, confirmation code,
45
52
  # or other identifying field for this payment application.
46
53
  # @type: integer
@@ -85,6 +92,11 @@ end
85
92
  # @format: uuid
86
93
  field :app_enrollment_id
87
94
 
95
+ # The date on which this record was last modified in source ERP.
96
+ # @type: string
97
+ # @format: date-time
98
+ field :source_modified_date, Types::Params::DateTime
99
+
88
100
  # The payment associated with this applied payment
89
101
  field :payment
90
102
 
@@ -43,6 +43,13 @@ end
43
43
  # @type: string
44
44
  field :email
45
45
 
46
+ # Possible statuses for a record that supports ERP write.
47
+ field :erp_write_status
48
+
49
+ # The name of the ErpWriteStatus for this payment
50
+ # @type: string
51
+ field :erp_write_status_name
52
+
46
53
  # The currency code of the payment.
47
54
  # @type: string
48
55
  field :currency_code
@@ -126,6 +126,10 @@ end
126
126
  # @format: double
127
127
  field :base_currency_unapplied_amount
128
128
 
129
+ # Bank account id for the payment.
130
+ # @type: string
131
+ field :bank_account_id
132
+
129
133
 
130
134
 
131
135
  end
@@ -0,0 +1,39 @@
1
+ class Schema::SfNotification < Lockstep::ApiRecord
2
+
3
+ # ApiRecord will crash unless `id_ref` is defined
4
+ def self.id_ref
5
+ nil
6
+ end
7
+
8
+ # Notification ID
9
+ # @type: string
10
+ # @format: uuid
11
+ field :id
12
+
13
+ # Source of the Notification
14
+ # @type: string
15
+ field :source
16
+
17
+ # Version of Notification
18
+ # @type: string
19
+ field :spec_version
20
+
21
+ # Describes event from Source
22
+ # @type: string
23
+ field :type
24
+
25
+ # The ID of the type in question (ex. NewPayment type would have the subject be a PaymentId)
26
+ # @type: string
27
+ # @format: uuid
28
+ field :subject
29
+
30
+ # RFC 2046 format content type
31
+ # @type: string
32
+ field :data_content_type
33
+
34
+ # Extra information about the event
35
+ field :data
36
+
37
+
38
+
39
+ end
@@ -34,6 +34,10 @@ end
34
34
  # @type: object
35
35
  field :errors
36
36
 
37
+ # The records that were skipped during sync keyed by ERP key
38
+ # @type: object
39
+ field :skips
40
+
37
41
 
38
42
 
39
43
  end