etl-integrations 0.1.85 → 0.1.86

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: a1b9a7a2e4780b4830cded5259e52ea8e630ac7cd27347df88c1a4fc06285daf
4
- data.tar.gz: '088f80483ec5f386aa11ae8bc735e4a9f518af56494b51242b92860216d4d339'
3
+ metadata.gz: dbf97c13292022f628ee36a0f99fee4712ff9e0c9f649e8ee1424de1984f1357
4
+ data.tar.gz: d974a3faae1b2e809d176b2bb2d3e2fa9b80b995eb68c1e3f3fb133f433a3a04
5
5
  SHA512:
6
- metadata.gz: cb77f7c5f9e29d772fcafa6f944f9ded6204a21f8bcbe42486546b8c713a1453a0df82716b70a424637e16626874753c77de1944877f1b622a4622e72187ef76
7
- data.tar.gz: 7b3ce9767ff9dfefefdee24ff117f528c8ee5d7458da2e1e8700a677cec87235ec3281764d9599c3aad6f51181413464460cc3c5c76291997b158e8834baa071
6
+ metadata.gz: a4fe646da773269cbd1c3207f830fb7343f5ca1a999b45262206aa905ad644648529b9a7a90469cf811eb43d7971bd4bcf2b39b174677c549c2da56ae4c981aa
7
+ data.tar.gz: aaa7835e8abf225d02f64bdbbc6c0bae1c0750e91f36cd5d8ed05dc0294561bfc365f48cc5baad8736e3c544d74c6ecf211ba70c87b991575faa864a7b031149
Binary file
Binary file
@@ -11,6 +11,7 @@ module Etl
11
11
  module Destination
12
12
  module Tally
13
13
  include Etl::Integrations::Core
14
+ include Etl::Integrations::Core::Utils
14
15
 
15
16
  API_VERSION = "1.0"
16
17
 
@@ -47,6 +48,21 @@ module Etl
47
48
  config = config.with_indifferent_access
48
49
  @tally_url = config[:tally_url]
49
50
  @company_name = config[:company_name]
51
+
52
+ check_tally_status(@tally_url)
53
+ end
54
+
55
+ def check_tally_status(tally_url)
56
+ uri = URI.parse(tally_url)
57
+ response = Net::HTTP.get_response(uri)
58
+
59
+ if response.is_a?(Net::HTTPSuccess)
60
+ puts "Tally is running at #{tally_url}"
61
+ else
62
+ raise "Tally is not running or not reachable at #{tally_url}"
63
+ end
64
+ rescue StandardError => e
65
+ raise "Error connecting to Tally: #{e.message}"
50
66
  end
51
67
 
52
68
  def process_records(records, stream)
@@ -70,7 +86,7 @@ module Etl
70
86
  end
71
87
 
72
88
  def send_data_to_tally(xml_payload = {})
73
- uri = URI.parse("#{@tally_url}/#{@company_name}")
89
+ uri = URI.parse("#{@tally_url}")
74
90
  request = Net::HTTP::Post.new(uri)
75
91
  request.content_type = 'application/xml' # Tally uses XML format
76
92
  request.body = xml_payload
@@ -97,16 +113,47 @@ module Etl
97
113
  end
98
114
  xml.REQUESTDATA do
99
115
  xml.TALLYMESSAGE('xmlns:UDF' => 'TallyUDF') do
100
- xml.VOUCHER do
101
- xml.DATE '20240915' # Static or dynamic date
116
+ xml.VOUCHER('VCHTYPE' => 'Sales', 'ACTION' => 'Create', 'OBJVIEW' => 'Invoice Voucher View') do
117
+ xml.DATE(record[:date].gsub('-', '')) # Date in YYYYMMDD format
118
+ xml.PARTYNAME record[:customer_name]
119
+ xml.PARTYLEDGERNAME record[:customer_name]
102
120
  xml.VOUCHERTYPENAME 'Sales'
103
- xml.NARRATION 'Test invoice from ETL Tool'
104
- xml.VOUCHERNUMBER record[:VOUCHERNUMBER] || 'INV-1002'
105
- xml.PARTYNAME record[:PARTYNAME] || 'XYZ Ltd'
106
- xml.AMOUNT record[:AMOUNT] || 10000
121
+ xml.REFERENCE record[:invoice_number]
122
+ xml.VOUCHERNUMBER record[:invoice_id] # If you want to use invoice_id as VOUCHERNUMBER
123
+ xml.NARRATION 'Invoice for ' + record[:customer_name]
124
+ xml.BASICBASEPARTYNAME record[:customer_name]
125
+
126
+ # Inventory Allocations
127
+ xml.ALLINVENTORYENTRIES__LIST do
128
+ xml.STOCKITEMNAME 'Product A' # This should be replaced with actual product names
129
+ xml.ISDEEMEDPOSITIVE 'No'
130
+ xml.AMOUNT record[:total]
131
+ xml.BILLEDQTY '1' # Adjust quantity as needed
132
+ xml.RATE record[:total] # Adjust rate as needed
133
+ xml.ACTUALQTY '1'
134
+ xml.ACCOUNTINGALLOCATIONS__LIST do
135
+ xml.LEDGERNAME record[:customer_name]
136
+ xml.AMOUNT record[:total]
137
+ end
138
+ end
139
+
140
+ # Ledger Entries (Tax and Sales Accounts)
107
141
  xml.LEDGERENTRIES__LIST do
108
- xml.LEDGERNAME 'Sales Account'
109
- xml.AMOUNT record[:AMOUNT] || 10000
142
+ xml.LEDGERNAME 'Sales Accounts'
143
+ xml.ISDEEMEDPOSITIVE 'No'
144
+ xml.AMOUNT record[:total]
145
+ end
146
+
147
+ xml.LEDGERENTRIES__LIST do
148
+ xml.LEDGERNAME 'Output GST @ 18%' # Adjust GST ledger name if different
149
+ xml.ISDEEMEDPOSITIVE 'No'
150
+ xml.AMOUNT '900' # Replace with calculated GST if available
151
+ end
152
+
153
+ xml.LEDGERENTRIES__LIST do
154
+ xml.LEDGERNAME 'ABC India Pvt. Ltd.'
155
+ xml.ISDEEMEDPOSITIVE 'Yes'
156
+ xml.AMOUNT '-5000' # Adjust based on the payment received or invoice amount
110
157
  end
111
158
  end
112
159
  end
@@ -117,6 +164,44 @@ module Etl
117
164
  xml.target! # Returns the generated XML string
118
165
  end
119
166
 
167
+ # def convert_to_xml(record)
168
+ # # Using Builder gem to create XML structure
169
+ # xml = Builder::XmlMarkup.new
170
+ # xml.instruct! :xml, version: '1.0', encoding: 'UTF-8'
171
+ # xml.ENVELOPE do
172
+ # xml.HEADER do
173
+ # xml.TALLYREQUEST 'Import Data'
174
+ # end
175
+ # xml.BODY do
176
+ # xml.IMPORTDATA do
177
+ # xml.REQUESTDESC do
178
+ # xml.REPORTNAME 'Vouchers'
179
+ # xml.STATICVARIABLES do
180
+ # xml.SVCURRENTCOMPANY @company_name
181
+ # end
182
+ # end
183
+ # xml.REQUESTDATA do
184
+ # xml.TALLYMESSAGE('xmlns:UDF' => 'TallyUDF') do
185
+ # xml.VOUCHER do
186
+ # xml.DATE '20240915' # Static or dynamic date
187
+ # xml.VOUCHERTYPENAME 'Sales'
188
+ # xml.NARRATION 'Test invoice from ETL Tool'
189
+ # xml.VOUCHERNUMBER record[:VOUCHERNUMBER] || 'INV-1002'
190
+ # xml.PARTYNAME record[:PARTYNAME] || 'XYZ Ltd'
191
+ # xml.AMOUNT record[:AMOUNT] || 10000
192
+ # xml.LEDGERENTRIES__LIST do
193
+ # xml.LEDGERNAME 'Sales Account'
194
+ # xml.AMOUNT record[:AMOUNT] || 10000
195
+ # end
196
+ # end
197
+ # end
198
+ # end
199
+ # end
200
+ # end
201
+ # end
202
+ # xml.target! # Returns the generated XML string
203
+ # end
204
+
120
205
  def authenticate_client
121
206
  # Tally may not need specific authentication steps like OAuth;
122
207
  # skipping authentication or implementing basic connection validation.
@@ -4,7 +4,7 @@
4
4
  "request_rate_concurrency": 10,
5
5
  "streams": [
6
6
  {
7
- "name": "Voucher",
7
+ "name": "Sales Accounts",
8
8
  "action": "create",
9
9
  "json_schema": {
10
10
  "type": "object",
@@ -26,6 +26,9 @@
26
26
  "Debit Note"
27
27
  ]
28
28
  },
29
+ "Particulars": {
30
+ "type": ["string", "null"]
31
+ },
29
32
  "Date": {
30
33
  "type": "string",
31
34
  "format": "date"
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Etl
4
4
  module Integrations
5
- VERSION = "0.1.85"
5
+ VERSION = "0.1.86"
6
6
 
7
7
  ENABLED_SOURCES = %w[
8
8
  Snowflake
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etl-integrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.85
4
+ version: 0.1.86
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anas Ahmed
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-17 00:00:00.000000000 Z
11
+ date: 2024-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -378,7 +378,8 @@ files:
378
378
  - README.md
379
379
  - Rakefile
380
380
  - etl-integrations-0.1.68.gem
381
- - etl-integrations.gemspec
381
+ - etl-integrations-0.1.79.gem
382
+ - etl-integrations-0.1.85.gem
382
383
  - lib/etl/integrations.rb
383
384
  - lib/etl/integrations/config.rb
384
385
  - lib/etl/integrations/core/base_connector.rb
@@ -509,7 +510,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
509
510
  - !ruby/object:Gem::Version
510
511
  version: '0'
511
512
  requirements: []
512
- rubygems_version: 3.4.20
513
+ rubygems_version: 3.4.1
513
514
  signing_key:
514
515
  specification_version: 4
515
516
  summary: Integration suite for open source reverse ETL platform
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/etl/integrations/rollout"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "etl-integrations"
7
- spec.version = Etl::Integrations::VERSION
8
- spec.authors = ["Anas Ahmed"]
9
- spec.email = ["anas31197@gmail.com"]
10
-
11
- spec.summary = "Integration suite for open source reverse ETL platform"
12
- spec.description = "Etl Integrations is a comprehensive Ruby gem designed to facilitate seamless connectivity between various data sources and SaaS platforms."
13
-
14
- spec.homepage = "https://github.com/anasValign/etl-tool"
15
- spec.license = "MIT"
16
- spec.required_ruby_version = ">= 2.6.0"
17
-
18
- # spec.metadata["allowed_push_host"] = nil
19
- spec.metadata["github_repo"] = "https://github.com/anasValign/etl-tool"
20
- spec.metadata["homepage_uri"] = spec.homepage
21
- spec.metadata["source_code_uri"] = "https://github.com/Etl/multiwoven/tree/main/integrations"
22
- spec.metadata["changelog_uri"] = "https://github.com/Etl/multiwoven/blob/main/integrations/CHANGELOG.md"
23
-
24
- # Specify which files should be added to the gem when it is released.
25
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
- spec.files = Dir.chdir(__dir__) do
27
- `git ls-files -z`.split("\x0").reject do |f|
28
- (File.expand_path(f) == __FILE__) ||
29
- f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
30
- end
31
- end
32
- spec.bindir = "exe"
33
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
- spec.require_paths = ["lib"]
35
-
36
- spec.add_runtime_dependency "activesupport"
37
- spec.add_runtime_dependency "async-websocket"
38
- spec.add_runtime_dependency "csv"
39
- spec.add_runtime_dependency "dry-schema"
40
- spec.add_runtime_dependency "dry-struct"
41
- spec.add_runtime_dependency "dry-types"
42
- spec.add_runtime_dependency "git"
43
- spec.add_runtime_dependency "google-apis-sheets_v4"
44
- spec.add_runtime_dependency "google-cloud-bigquery"
45
- spec.add_runtime_dependency "hubspot-api-client"
46
- spec.add_runtime_dependency "net-sftp"
47
- spec.add_runtime_dependency "pg"
48
- spec.add_runtime_dependency "rake"
49
- spec.add_runtime_dependency "restforce"
50
- spec.add_runtime_dependency "ruby-limiter"
51
- spec.add_runtime_dependency "ruby-odbc"
52
- spec.add_runtime_dependency "sequel"
53
- spec.add_runtime_dependency "slack-ruby-client"
54
- spec.add_runtime_dependency "stripe"
55
-
56
- spec.add_development_dependency "byebug"
57
- spec.add_development_dependency "rspec"
58
- spec.add_development_dependency "rubocop"
59
- spec.add_development_dependency "simplecov"
60
- spec.add_development_dependency "simplecov_json_formatter"
61
- spec.add_development_dependency "webmock"
62
-
63
- # For more information and examples about making a new gem, check out our
64
- # guide at: https://bundler.io/guides/creating_gem.html
65
- end