ruby-vies 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8c0bd86c18b4c9e773d936a835f84ab3f2e64de93ccc06c4c656de90266d489c
4
+ data.tar.gz: bf5052d3d68ddf92abca4702bfef17bb084fcd6321b3d282d5265400f55fa5c0
5
+ SHA512:
6
+ metadata.gz: 33e7d35d7dcd783c2bc7f33e2fb681e5ce27b1cccfbabe33bf57f0e5f71e2880e3426fb6c3a640c1dbc1745204536be01c3224519bd073d0c46cc2856fc4dbde
7
+ data.tar.gz: 94fc8a73f7d26a8db967280ebd9fd9ca34840d55f4d58355cb3a032573090f787cc69e9d73891c993334ce1512233073b2eda85713c396ac958ea9f8ea88bd2b
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ /*.gem
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/ruby-vies.iml" filepath="$PROJECT_DIR$/.idea/ruby-vies.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,96 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="jdk" jdkName="rbenv: 2.7.4" jdkType="RUBY_SDK" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v6.1.4.3, rbenv: 2.7.4) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0, rbenv: 2.7.4) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="akami (v1.3.1, rbenv: 2.7.4) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, rbenv: 2.7.4) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, rbenv: 2.7.4) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.24, rbenv: 2.7.4) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.9, rbenv: 2.7.4) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, rbenv: 2.7.4) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="finest-builder (v1.1.1, rbenv: 2.7.4) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="gyoku (v1.3.1, rbenv: 2.7.4) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="httparty (v0.20.0, rbenv: 2.7.4) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="httpi (v2.5.0, rbenv: 2.7.4) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.8.11, rbenv: 2.7.4) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="mime-types (v3.4.1, rbenv: 2.7.4) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2021.1115, rbenv: 2.7.4) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.15.0, rbenv: 2.7.4) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, rbenv: 2.7.4) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.12.5, rbenv: 2.7.4) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="nori (v2.6.0, rbenv: 2.7.4) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.21.0, rbenv: 2.7.4) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.0.3.2, rbenv: 2.7.4) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.6, rbenv: 2.7.4) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="racc (v1.6.0, rbenv: 2.7.4) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="rack (v2.2.3, rbenv: 2.7.4) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, rbenv: 2.7.4) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, rbenv: 2.7.4) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.2.0, rbenv: 2.7.4) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, rbenv: 2.7.4) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.10.0, rbenv: 2.7.4) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.10.1, rbenv: 2.7.4) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.1, rbenv: 2.7.4) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.2, rbenv: 2.7.4) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.3, rbenv: 2.7.4) [gem]" level="application" />
47
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.23.0, rbenv: 2.7.4) [gem]" level="application" />
48
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.15.0, rbenv: 2.7.4) [gem]" level="application" />
49
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, rbenv: 2.7.4) [gem]" level="application" />
50
+ <orderEntry type="library" scope="PROVIDED" name="savon (v2.12.1, rbenv: 2.7.4) [gem]" level="application" />
51
+ <orderEntry type="library" scope="PROVIDED" name="socksify (v1.7.1, rbenv: 2.7.4) [gem]" level="application" />
52
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, rbenv: 2.7.4) [gem]" level="application" />
53
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, rbenv: 2.7.4) [gem]" level="application" />
54
+ <orderEntry type="library" scope="PROVIDED" name="wasabi (v3.6.1, rbenv: 2.7.4) [gem]" level="application" />
55
+ <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.1, rbenv: 2.7.4) [gem]" level="application" />
56
+ </component>
57
+ <component name="RakeTasksCache">
58
+ <option name="myRootTask">
59
+ <RakeTaskImpl id="rake">
60
+ <subtasks>
61
+ <RakeTaskImpl description="Build ruby-vies-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
62
+ <RakeTaskImpl id="build">
63
+ <subtasks>
64
+ <RakeTaskImpl description="Generate SHA512 checksum if ruby-vies-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
65
+ </subtasks>
66
+ </RakeTaskImpl>
67
+ <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
68
+ <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
69
+ <RakeTaskImpl description="Build and install ruby-vies-0.1.0.gem into system gems" fullCommand="install" id="install" />
70
+ <RakeTaskImpl id="install">
71
+ <subtasks>
72
+ <RakeTaskImpl description="Build and install ruby-vies-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
73
+ </subtasks>
74
+ </RakeTaskImpl>
75
+ <RakeTaskImpl description="Create tag v0.1.0 and build and push ruby-vies-0.1.0.gem to TODO: Set to 'https://mygemserver.com'" fullCommand="release[remote]" id="release[remote]" />
76
+ <RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
77
+ <RakeTaskImpl id="rubocop">
78
+ <subtasks>
79
+ <RakeTaskImpl description="Auto-correct RuboCop offenses" fullCommand="rubocop:auto_correct" id="auto_correct" />
80
+ </subtasks>
81
+ </RakeTaskImpl>
82
+ <RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
83
+ <RakeTaskImpl description="" fullCommand="default" id="default" />
84
+ <RakeTaskImpl description="" fullCommand="release" id="release" />
85
+ <RakeTaskImpl id="release">
86
+ <subtasks>
87
+ <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
88
+ <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
89
+ <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
90
+ </subtasks>
91
+ </RakeTaskImpl>
92
+ </subtasks>
93
+ </RakeTaskImpl>
94
+ </option>
95
+ </component>
96
+ </module>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.4
6
+ before_install: gem install bundler -v 2.2.24
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2021-12-16
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at edugarcas@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in ruby-vies.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.7"
data/Gemfile.lock ADDED
@@ -0,0 +1,113 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby-vies (0.1.0)
5
+ activesupport (~> 6.1)
6
+ finest-builder (~> 1.0)
7
+ httparty (~> 0.18)
8
+ rake (~> 13.0)
9
+ rspec (~> 3.0)
10
+ rubocop (~> 1.7)
11
+ savon (~> 2.3)
12
+
13
+ GEM
14
+ remote: https://rubygems.org/
15
+ specs:
16
+ activesupport (6.1.4.3)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ zeitwerk (~> 2.3)
22
+ addressable (2.8.0)
23
+ public_suffix (>= 2.0.2, < 5.0)
24
+ akami (1.3.1)
25
+ gyoku (>= 0.4.0)
26
+ nokogiri
27
+ ast (2.4.2)
28
+ builder (3.2.4)
29
+ concurrent-ruby (1.1.9)
30
+ diff-lcs (1.4.4)
31
+ finest-builder (1.1.1)
32
+ gyoku (1.3.1)
33
+ builder (>= 2.1.2)
34
+ httparty (0.20.0)
35
+ mime-types (~> 3.0)
36
+ multi_xml (>= 0.5.2)
37
+ httpi (2.5.0)
38
+ rack
39
+ socksify
40
+ i18n (1.8.11)
41
+ concurrent-ruby (~> 1.0)
42
+ mime-types (3.4.1)
43
+ mime-types-data (~> 3.2015)
44
+ mime-types-data (3.2021.1115)
45
+ minitest (5.15.0)
46
+ multi_xml (0.6.0)
47
+ nokogiri (1.12.5-x86_64-linux)
48
+ racc (~> 1.4)
49
+ nori (2.6.0)
50
+ parallel (1.21.0)
51
+ parser (3.0.3.2)
52
+ ast (~> 2.4.1)
53
+ public_suffix (4.0.6)
54
+ racc (1.6.0)
55
+ rack (2.2.3)
56
+ rainbow (3.0.0)
57
+ rake (13.0.6)
58
+ regexp_parser (2.2.0)
59
+ rexml (3.2.5)
60
+ rspec (3.10.0)
61
+ rspec-core (~> 3.10.0)
62
+ rspec-expectations (~> 3.10.0)
63
+ rspec-mocks (~> 3.10.0)
64
+ rspec-core (3.10.1)
65
+ rspec-support (~> 3.10.0)
66
+ rspec-expectations (3.10.1)
67
+ diff-lcs (>= 1.2.0, < 2.0)
68
+ rspec-support (~> 3.10.0)
69
+ rspec-mocks (3.10.2)
70
+ diff-lcs (>= 1.2.0, < 2.0)
71
+ rspec-support (~> 3.10.0)
72
+ rspec-support (3.10.3)
73
+ rubocop (1.23.0)
74
+ parallel (~> 1.10)
75
+ parser (>= 3.0.0.0)
76
+ rainbow (>= 2.2.2, < 4.0)
77
+ regexp_parser (>= 1.8, < 3.0)
78
+ rexml
79
+ rubocop-ast (>= 1.12.0, < 2.0)
80
+ ruby-progressbar (~> 1.7)
81
+ unicode-display_width (>= 1.4.0, < 3.0)
82
+ rubocop-ast (1.15.0)
83
+ parser (>= 3.0.1.1)
84
+ ruby-progressbar (1.11.0)
85
+ savon (2.12.1)
86
+ akami (~> 1.2)
87
+ builder (>= 2.1.2)
88
+ gyoku (~> 1.2)
89
+ httpi (~> 2.3)
90
+ nokogiri (>= 1.8.1)
91
+ nori (~> 2.4)
92
+ wasabi (~> 3.4)
93
+ socksify (1.7.1)
94
+ tzinfo (2.0.4)
95
+ concurrent-ruby (~> 1.0)
96
+ unicode-display_width (2.1.0)
97
+ wasabi (3.6.1)
98
+ addressable
99
+ httpi (~> 2.0)
100
+ nokogiri (>= 1.4.2)
101
+ zeitwerk (2.5.1)
102
+
103
+ PLATFORMS
104
+ x86_64-linux
105
+
106
+ DEPENDENCIES
107
+ rake (~> 13.0)
108
+ rspec (~> 3.0)
109
+ rubocop (~> 1.7)
110
+ ruby-vies!
111
+
112
+ BUNDLED WITH
113
+ 2.2.24
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 eddygarcas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Ruby::Vies
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ruby/vies`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'ruby-vies'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install ruby-vies
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ruby-vies. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/ruby-vies/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Ruby::Vies project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ruby-vies/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: %i[spec]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "ruby/vies"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ruby
4
+ module Vies
5
+ VERSION = "0.1.1"
6
+ end
7
+ end
data/lib/ruby/vies.rb ADDED
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "vies/version"
4
+ require "savon"
5
+ require "httparty"
6
+ require "finest/builder"
7
+ require "active_support/core_ext/module"
8
+ require "active_support/core_ext/object"
9
+
10
+ module Ruby
11
+ module Vies
12
+ class Error < StandardError; end
13
+
14
+ class Client
15
+ include Savon
16
+ include HTTParty
17
+ include Finest::Builder
18
+
19
+ mattr_reader :id_numbers, default: { FR: "((12 + 3 * ( %d.divmod(97)[1])).divmod(97)[1])" }
20
+
21
+ def initialize(args = {})
22
+ super args
23
+ end
24
+
25
+ def check_vat_details(args = {})
26
+ args[:country_code].upcase == "FR" ? check_siren(args) : check_vat(args)
27
+ rescue => e
28
+ { error: e&.message, valid: false }
29
+ end
30
+
31
+ protected
32
+
33
+ def generate_id(vat = {})
34
+ id_numbers[vat[:country_code].to_sym] &&
35
+ "%02<digit>d%<vat>d" % {
36
+ digit: eval(id_numbers[vat[:country_code].to_sym] % vat[:vat_number]),
37
+ vat: vat[:vat_number]
38
+ } || vat[:vat_number]
39
+ rescue
40
+ vat[:vat_number]
41
+ end
42
+
43
+ def check_vat(args = {})
44
+ Savon::Client.new(wsdl: "https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl")
45
+ .call(
46
+ :check_vat,
47
+ message: args.merge({ vat_number: generate_id(args) }).as_json.transform_keys! { |i| i.camelize(:lower) },
48
+ message_tag: :checkVat
49
+ ).body[:check_vat_response].as_json(except: :@xmlns)
50
+ end
51
+
52
+ def check_siren(args = {})
53
+ url = "https://api.avis-situation-sirene.insee.fr/identification/siren/#{args.fetch(:vat_number)}"
54
+ if (resp = JSON.parse(self.class.method(:get).call(url).body))["code"]
55
+ { error: resp["message"], valid: false }
56
+ else
57
+ {
58
+ valid: true,
59
+ name: resp.dig("uniteLegale", "periodesUniteLegale")&.first&.dig("denominationUniteLegale"),
60
+ address: resp.dig("etablissements")&.first&.dig("adresseEtablissement").values.join(" "),
61
+ siren: resp.dig("etablissements")&.first&.dig("siren"),
62
+ siret: resp.dig("etablissements")&.first&.dig("siret"),
63
+ nic: resp.dig("etablissements")&.first&.dig("nic"),
64
+ created: resp.dig("etablissements")&.first&.dig("dateCreationEtablissement")
65
+ }
66
+ end
67
+
68
+ end
69
+ end
70
+ end
71
+ end
data/ruby-vies.gemspec ADDED
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/ruby/vies/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "ruby-vies"
7
+ spec.version = Ruby::Vies::VERSION
8
+ spec.authors = ["Eduard Garcia Castelló"]
9
+ spec.email = %w[edugarcas@gmail.com eduard@rzilient.club]
10
+
11
+ spec.summary = "Ruby EU VIES VAT and SIREN number validation"
12
+ spec.description = "Vies is a EU service that checks EU VAT business number validation and sends back its information."
13
+ spec.homepage = "https://github.com/eddygarcas/ruby-miradore"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.4")
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/eddygarcas/ruby-vies"
21
+ spec.metadata["changelog_uri"] = "https://github.com/eddygarcas/ruby-vies"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ # Uncomment to register a new dependency of your gem
33
+ # spec.add_dependency "example-gem", "~> 1.0"
34
+ spec.add_dependency "finest-builder", "~> 1.0"
35
+ spec.add_dependency "httparty", "~> 0.18"
36
+ spec.add_dependency "rake", "~> 13.0"
37
+ spec.add_dependency "rspec", "~> 3.0"
38
+ spec.add_dependency "rubocop", "~> 1.7"
39
+ spec.add_dependency "savon", "~> 2.3"
40
+ spec.add_dependency "activesupport", "~> 6.1"
41
+
42
+ # For more information and examples about making a new gem, checkout our
43
+ # guide at: https://bundler.io/guides/creating_gem.html
44
+ end
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-vies
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Eduard Garcia Castelló
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-12-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: finest-builder
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: httparty
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.18'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.18'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.7'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: savon
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.3'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: activesupport
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '6.1'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '6.1'
111
+ description: Vies is a EU service that checks EU VAT business number validation and
112
+ sends back its information.
113
+ email:
114
+ - edugarcas@gmail.com
115
+ - eduard@rzilient.club
116
+ executables: []
117
+ extensions: []
118
+ extra_rdoc_files: []
119
+ files:
120
+ - ".gitignore"
121
+ - ".idea/.gitignore"
122
+ - ".idea/modules.xml"
123
+ - ".idea/ruby-vies.iml"
124
+ - ".idea/vcs.xml"
125
+ - ".rspec"
126
+ - ".rubocop.yml"
127
+ - ".travis.yml"
128
+ - CHANGELOG.md
129
+ - CODE_OF_CONDUCT.md
130
+ - Gemfile
131
+ - Gemfile.lock
132
+ - LICENSE.txt
133
+ - README.md
134
+ - Rakefile
135
+ - bin/console
136
+ - bin/setup
137
+ - lib/ruby/vies.rb
138
+ - lib/ruby/vies/version.rb
139
+ - ruby-vies.gemspec
140
+ homepage: https://github.com/eddygarcas/ruby-miradore
141
+ licenses:
142
+ - MIT
143
+ metadata:
144
+ allowed_push_host: https://rubygems.org/
145
+ homepage_uri: https://github.com/eddygarcas/ruby-miradore
146
+ source_code_uri: https://github.com/eddygarcas/ruby-vies
147
+ changelog_uri: https://github.com/eddygarcas/ruby-vies
148
+ post_install_message:
149
+ rdoc_options: []
150
+ require_paths:
151
+ - lib
152
+ required_ruby_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: 2.7.4
157
+ required_rubygems_version: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ requirements: []
163
+ rubygems_version: 3.1.6
164
+ signing_key:
165
+ specification_version: 4
166
+ summary: Ruby EU VIES VAT and SIREN number validation
167
+ test_files: []