getapp 0.1.1 → 0.1.2

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: 738324d07987f16aac1b39b52b119064ae4099c0411c7a55449f1b83bf20caf3
4
- data.tar.gz: 31213148b6a46a914a2a99e8a348b43ee44bbabfd41110cc23c3a0dccbad2043
3
+ metadata.gz: 02b2b12a84eed0626b5a7398597ce6450a2e611b693da18627ba3b605bc40f84
4
+ data.tar.gz: 82f69ed3f1821554e69cf84d7c197688739c471c606529e2560a5c2ebadae8fc
5
5
  SHA512:
6
- metadata.gz: fbe71091da435d5c1101b551df587040ec0473a376520197e9408d6065b2bbff93b62f1de09e805254a69beed37fc2bcd74e66cc318a8f10e56e04f7127d2439
7
- data.tar.gz: fd2568fd8b205c9d32fb4391820b0a23dae6ee9188ebbf0617aad41ba486a64690ef7e0ebbce69b996b02f2ff2c62de222499391deb5ae32fda09529d8f73950
6
+ metadata.gz: de9a59e2fa7cbec92d41ff854ea1f82694a7d483a70b12959371cf964404345714981b4c1b0e7f00af35ac667faa4837335f2fe16b278ac9849ec8f57f980997
7
+ data.tar.gz: c927b6688fa39e454476ea464cfdbde498f33224ccdd11d0ecd73f689fec08dd0d7491b3761f8073ea64b3564caaa73ae9acbbc6bb86f7e55d103a90f26bb664
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- getapp (0.1.1)
4
+ getapp (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -30,6 +30,8 @@ Or install it yourself as:
30
30
 
31
31
  Currently, supported products imports from capterra and softwareadvice.
32
32
 
33
+ Sample files can be found at under test/assets/feed-products
34
+
33
35
  ## Development
34
36
 
35
37
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require "bundler/setup"
4
+
5
+ # Load main APP.
3
6
  require 'getapp'
4
7
 
5
8
  # Thor is a toolkit for building powerful command-line interfaces.
@@ -6,5 +6,6 @@ module Getapp
6
6
 
7
7
  module Capterra
8
8
  class FileNotFound < Getapp::Error; end
9
+ class FileFormatNotSupported < Getapp::Error; end
9
10
  end
10
11
  end
@@ -11,6 +11,8 @@ module Getapp
11
11
  # into Getapp Products format.
12
12
  #
13
13
  class Capterra
14
+ SUPPORTED_FILE_FORMATS = ['.yaml', '.yml'].freeze
15
+
14
16
  attr_reader :path, :verbose, :products
15
17
 
16
18
  # == Getapp::Import::Capterra initialize Method
@@ -34,6 +36,7 @@ module Getapp
34
36
  #
35
37
  def import
36
38
  check_file_exist?
39
+ validate_file_formats
37
40
  parse_products
38
41
  import_products
39
42
  true
@@ -53,6 +56,18 @@ module Getapp
53
56
  raise Getapp::Capterra::FileNotFound, "Capterra: File does not exist." unless File.exist?(path)
54
57
  end
55
58
 
59
+ # == Getapp::Import::Capterra validate_file_formats Private Method
60
+ #
61
+ # Check that file have valid format.
62
+ # Raise an Getapp::Capterra::FileFormatNotSupported exception if
63
+ # file format is not included in list.
64
+ #
65
+ def validate_file_formats
66
+ file_format = File.extname(path)
67
+ message = "File format (#{file_format}) not supported yet."
68
+ raise Getapp::Capterra::FileFormatNotSupported, message unless SUPPORTED_FILE_FORMATS.include?(file_format)
69
+ end
70
+
56
71
  # == Getapp::Import::Capterra parse_products Private Method
57
72
  #
58
73
  # Load yaml file into JSON format.
@@ -1,3 +1,3 @@
1
1
  module Getapp
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "0.1.2".freeze
3
3
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prince Bansal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-25 00:00:00.000000000 Z
11
+ date: 2020-07-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Update product inventory of SaaS products from several sources. Each
14
14
  source provides its content to us in a different format.
@@ -38,6 +38,7 @@ files:
38
38
  - lib/getapp/import/capterra.rb
39
39
  - lib/getapp/import/products.rb
40
40
  - lib/getapp/version.rb
41
+ - sql_solution.zip
41
42
  homepage: https://github.com/erprincebansal/getapp
42
43
  licenses:
43
44
  - MIT