devme-sdk-ruby 1.0.2

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.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile +9 -0
  4. data/Gemfile.lock +71 -0
  5. data/LICENSE.md +25 -0
  6. data/README.md +97 -0
  7. data/Rakefile +10 -0
  8. data/devme-sdk-ruby.gemspec +38 -0
  9. data/examples/app/.gitignore +198 -0
  10. data/examples/app/Gemfile +6 -0
  11. data/examples/app/Gemfile.lock +23 -0
  12. data/examples/app/test-api.rb +20 -0
  13. data/lib/devme-sdk-ruby/api/country_api.rb +178 -0
  14. data/lib/devme-sdk-ruby/api/currency_api.rb +333 -0
  15. data/lib/devme-sdk-ruby/api/domain_api.rb +81 -0
  16. data/lib/devme-sdk-ruby/api/email_api.rb +91 -0
  17. data/lib/devme-sdk-ruby/api/ip_api.rb +81 -0
  18. data/lib/devme-sdk-ruby/api/phone_api.rb +85 -0
  19. data/lib/devme-sdk-ruby/api/utils_api.rb +78 -0
  20. data/lib/devme-sdk-ruby/api_client.rb +390 -0
  21. data/lib/devme-sdk-ruby/api_error.rb +57 -0
  22. data/lib/devme-sdk-ruby/configuration.rb +285 -0
  23. data/lib/devme-sdk-ruby/models/convert_currency_out.rb +280 -0
  24. data/lib/devme-sdk-ruby/models/error.rb +251 -0
  25. data/lib/devme-sdk-ruby/models/get_country_details_out.rb +230 -0
  26. data/lib/devme-sdk-ruby/models/get_currency_details_out.rb +230 -0
  27. data/lib/devme-sdk-ruby/models/get_currency_exchange_rate_out.rb +250 -0
  28. data/lib/devme-sdk-ruby/models/get_domain_whois_out.rb +230 -0
  29. data/lib/devme-sdk-ruby/models/get_email_details_out.rb +290 -0
  30. data/lib/devme-sdk-ruby/models/get_ip_details_city_out.rb +260 -0
  31. data/lib/devme-sdk-ruby/models/get_ip_details_out.rb +269 -0
  32. data/lib/devme-sdk-ruby/models/get_phone_details_out.rb +270 -0
  33. data/lib/devme-sdk-ruby/models/http_error_out.rb +252 -0
  34. data/lib/devme-sdk-ruby/models/list_countries_item.rb +230 -0
  35. data/lib/devme-sdk-ruby/models/list_countries_out.rb +242 -0
  36. data/lib/devme-sdk-ruby/models/list_currencies_item.rb +314 -0
  37. data/lib/devme-sdk-ruby/models/list_currencies_out.rb +242 -0
  38. data/lib/devme-sdk-ruby/models/who_am_i_out.rb +264 -0
  39. data/lib/devme-sdk-ruby/version.rb +15 -0
  40. data/lib/devme-sdk-ruby.rb +62 -0
  41. data/spec/api/country_api_spec.rb +66 -0
  42. data/spec/api/currency_api_spec.rb +101 -0
  43. data/spec/api/domain_api_spec.rb +46 -0
  44. data/spec/api/email_api_spec.rb +48 -0
  45. data/spec/api/ip_api_spec.rb +53 -0
  46. data/spec/api/phone_api_spec.rb +46 -0
  47. data/spec/api/utils_api_spec.rb +45 -0
  48. data/spec/api_client_spec.rb +226 -0
  49. data/spec/configuration_spec.rb +42 -0
  50. data/spec/spec_helper.rb +111 -0
  51. metadata +146 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ae34a3e792367f426e1985eb3443dd92a8e69a156bd5cb22777df4407d66bbee
4
+ data.tar.gz: db7c44b8008694d8563a31ffdbf08346e74d8680d6ed70dcb28e49b8f5df0763
5
+ SHA512:
6
+ metadata.gz: 31fffcfc3aaee68ac47834caf63ed697842b6029173ce1496afa752a0662172924df02b5b4e0fedbb8f70f925ceae929d983b59614b362d0926b9501aba9e1f8
7
+ data.tar.gz: 651ab46fde5d3918da231e823093b473e180e82764362bcd31f8b91be92ae5a8e832855e9ca12112446dedaa6c005b48033ab8e5e19e9c091c0fd4574c59c8bf
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Change Log
2
+
3
+ ## v1.0.0
4
+ - Initial stable release
5
+ - Adding tests
6
+ - Adding documentation
7
+ - Adding examples
8
+ - Adding examples to README.md
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 13.0.1'
7
+ gem 'pry-byebug'
8
+ gem 'rubocop', '~> 0.93.0'
9
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ devme-sdk-ruby (1.0.1)
5
+ typhoeus (~> 1.0, >= 1.0.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ byebug (11.1.3)
12
+ coderay (1.1.3)
13
+ diff-lcs (1.5.0)
14
+ ethon (0.15.0)
15
+ ffi (>= 1.15.0)
16
+ ffi (1.15.5)
17
+ method_source (1.0.0)
18
+ parallel (1.21.0)
19
+ parser (3.1.0.0)
20
+ ast (~> 2.4.1)
21
+ pry (0.13.1)
22
+ coderay (~> 1.1)
23
+ method_source (~> 1.0)
24
+ pry-byebug (3.9.0)
25
+ byebug (~> 11.0)
26
+ pry (~> 0.13.0)
27
+ rainbow (3.1.1)
28
+ rake (13.0.6)
29
+ regexp_parser (2.2.0)
30
+ rexml (3.2.5)
31
+ rspec (3.10.0)
32
+ rspec-core (~> 3.10.0)
33
+ rspec-expectations (~> 3.10.0)
34
+ rspec-mocks (~> 3.10.0)
35
+ rspec-core (3.10.1)
36
+ rspec-support (~> 3.10.0)
37
+ rspec-expectations (3.10.2)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.10.0)
40
+ rspec-mocks (3.10.2)
41
+ diff-lcs (>= 1.2.0, < 2.0)
42
+ rspec-support (~> 3.10.0)
43
+ rspec-support (3.10.3)
44
+ rubocop (0.93.1)
45
+ parallel (~> 1.10)
46
+ parser (>= 2.7.1.5)
47
+ rainbow (>= 2.2.2, < 4.0)
48
+ regexp_parser (>= 1.8)
49
+ rexml
50
+ rubocop-ast (>= 0.6.0)
51
+ ruby-progressbar (~> 1.7)
52
+ unicode-display_width (>= 1.4.0, < 2.0)
53
+ rubocop-ast (1.15.1)
54
+ parser (>= 3.0.1.1)
55
+ ruby-progressbar (1.11.0)
56
+ typhoeus (1.4.0)
57
+ ethon (>= 0.9.0)
58
+ unicode-display_width (1.8.0)
59
+
60
+ PLATFORMS
61
+ ruby
62
+
63
+ DEPENDENCIES
64
+ devme-sdk-ruby!
65
+ pry-byebug
66
+ rake (~> 13.0.1)
67
+ rspec (~> 3.6, >= 3.6.0)
68
+ rubocop (~> 0.93.0)
69
+
70
+ BUNDLED WITH
71
+ 1.17.2
data/LICENSE.md ADDED
@@ -0,0 +1,25 @@
1
+ The MIT License (MIT)
2
+ =====================
3
+
4
+ Copyright © `2021` `DEV.ME`
5
+
6
+ Permission is hereby granted, free of charge, to any person
7
+ obtaining a copy of this software and associated documentation
8
+ files (the “Software”), to deal in the Software without
9
+ restriction, including without limitation the rights to use,
10
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the
12
+ Software is furnished to do so, subject to the following
13
+ conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # DEV.ME SDK for Ruby
2
+
3
+ [![Build Status](https://github.com/devmehq/devme-sdk-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/devmehq/devme-sdk-ruby/actions/workflows/ci.yml)
4
+ [![Gem Version](https://img.shields.io/gem/v/devme-sdk-ruby)](https://rubygems.org/gems/devme-sdk-ruby)
5
+ [![Downloads](https://img.shields.io/gem/dt/devme-sdk-ruby)](https://rubygems.org/gems/devme-sdk-ruby)
6
+
7
+ DEV.ME SDK for Ruby
8
+
9
+ > Compatible with Ruby on Rails
10
+
11
+ ## Get Your Free API Key
12
+
13
+ [Signup Here](https://dev.me/signup) and Get Your Free API Key
14
+
15
+ ## Installation and usage instructions
16
+
17
+ ## Installation
18
+
19
+ Install the module through GEM:
20
+
21
+ ```shell
22
+ gem install devme-sdk-ruby
23
+ ```
24
+
25
+ Or GEMFILE:
26
+
27
+ ```shell
28
+ gem "devme-sdk-ruby", "~> 1.0"
29
+ ```
30
+
31
+ ## Examples
32
+
33
+ ### Currency API Conversion
34
+
35
+ ```ruby
36
+ require 'devme-sdk-ruby'
37
+ DevmeSdk.configure do |config|
38
+ config.api_key['APIKeyHeader'] = 'demo-key'
39
+ end
40
+ @api_instance = DevmeSdk::CurrencyApi.new
41
+ result = @api_instance.v1_convert_currency(from = 'USD', to = 'EUR', opts = { amount: 10 })
42
+ # puts result
43
+ # {
44
+ # convertedAmount: 8.819,
45
+ # convertedText: '10 USD equal to 8.819 EUR',
46
+ # exchangeRate: 0.8819,
47
+ # from: 'USD',
48
+ # originalAmount: 10,
49
+ # rateTime: '2022-01-20T14:49:28.046Z',
50
+ # to: 'EUR'
51
+ # }
52
+ ```
53
+
54
+ ### IP API Geolocation, IP2Location, IP Data
55
+
56
+ ```ruby
57
+ require 'devme-sdk-ruby'
58
+ DevmeSdk.configure do |config|
59
+ config.api_key['APIKeyHeader'] = 'demo-key'
60
+ end
61
+ @api_instance = DevmeSdk::IPApi.new
62
+ result = @api_instance.v1_get_ip_details(opts = { ip: '52.45.23.11' })
63
+
64
+ # {
65
+ # asn: 14618,
66
+ # aso: 'AMAZON-AES',
67
+ # city: {
68
+ # accuracyRadius: 1000,
69
+ # latitude: 39.0469,
70
+ # longitude: -77.4903,
71
+ # metroCode: 511,
72
+ # name: 'Ashburn',
73
+ # timeZone: 'America/New_York',
74
+ # },
75
+ # countryCode: 'US',
76
+ # ip: '52.45.23.11',
77
+ # registeredCountryCode: 'US',
78
+ # }
79
+
80
+ ```
81
+
82
+ ## Testing
83
+
84
+ ```shell
85
+ bundle exec rake
86
+ ```
87
+
88
+ ## Need Help?
89
+
90
+ If you need help please drop us a message, we would be glad to help @ [Contact us](http://dev.me/contact-us)
91
+
92
+ ## Contributing
93
+
94
+ Please feel free to open an issue or create a pull request and fix bugs or add features, All contributions are welcome.
95
+ Thank you!
96
+
97
+ ## LICENSE [MIT](LICENSE.md)
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
8
+ rescue LoadError
9
+ # no rspec available
10
+ end
@@ -0,0 +1,38 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ =begin
4
+ #DEV.ME API Documentation
5
+
6
+ #DEV.ME API Documentation [Currency Conversion and Exchange Rates API](https://dev.me/products/currency) - [IP2Location, IP Country, IP Information API](https://dev.me/products/ip) - [Email Validation, Mailbox Verification](https://dev.me/products/email) - [Phone Number Validation](https://dev.me/products/phone). You can learn more at [dev.me](https://dev.me). For this example you can use api key `demo-key` to test the APIs
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@dev.me
10
+
11
+
12
+
13
+ =end
14
+
15
+ $:.push File.expand_path("../lib", __FILE__)
16
+ require "devme-sdk-ruby/version"
17
+
18
+ Gem::Specification.new do |s|
19
+ s.name = "devme-sdk-ruby"
20
+ s.version = DevmeSdk::VERSION
21
+ s.platform = Gem::Platform::RUBY
22
+ s.authors = ["DEV.ME Team"]
23
+ s.email = ["support@dev.me"]
24
+ s.homepage = "https://github.com/devmehq/devme-sdk-ruby"
25
+ s.summary = "DEV.ME SDK for Ruby"
26
+ s.description = "DEV.ME API Documentation [Currency Conversion and Exchange Rates API](https://dev.me/products/currency) - [IP2Location, IP Country, IP Information API](https://dev.me/products/ip) - [Email Validation, Mailbox Verification](https://dev.me/products/email) - [Phone Number Validation](https://dev.me/products/phone). You can learn more at [dev.me](https://dev.me). For this example you can use api key `demo-key` to test the APIs"
27
+ s.license = "MIT"
28
+ s.required_ruby_version = ">= 2.4"
29
+
30
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
31
+
32
+ s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
33
+
34
+ s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
35
+ s.test_files = `find spec/*`.split("\n")
36
+ s.executables = []
37
+ s.require_paths = ["lib"]
38
+ end
@@ -0,0 +1,198 @@
1
+ ### Windows template
2
+ # Windows thumbnail cache files
3
+ Thumbs.db
4
+ Thumbs.db:encryptable
5
+ ehthumbs.db
6
+ ehthumbs_vista.db
7
+
8
+ # Dump file
9
+ *.stackdump
10
+
11
+ # Folder config file
12
+ [Dd]esktop.ini
13
+
14
+ # Recycle Bin used on file shares
15
+ $RECYCLE.BIN/
16
+
17
+ # Windows Installer files
18
+ *.cab
19
+ *.msi
20
+ *.msix
21
+ *.msm
22
+ *.msp
23
+
24
+ # Windows shortcuts
25
+ *.lnk
26
+
27
+ ### Node template
28
+ # Logs
29
+ logs
30
+ *.log
31
+ npm-debug.log*
32
+ yarn-debug.log*
33
+ yarn-error.log*
34
+ lerna-debug.log*
35
+
36
+ # Diagnostic reports (https://nodejs.org/api/report.html)
37
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
38
+
39
+ # Runtime data
40
+ pids
41
+ *.pid
42
+ *.seed
43
+ *.pid.lock
44
+
45
+ # Directory for instrumented libs generated by jscoverage/JSCover
46
+ lib-cov
47
+
48
+ # Coverage directory used by tools like istanbul
49
+ coverage
50
+ *.lcov
51
+
52
+ # nyc test coverage
53
+ .nyc_output
54
+
55
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
56
+ .grunt
57
+
58
+ # Bower dependency directory (https://bower.io/)
59
+ bower_components
60
+
61
+ # node-waf configuration
62
+ .lock-wscript
63
+
64
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
65
+ build/Release
66
+
67
+ # Dependency directories
68
+ node_modules/
69
+ jspm_packages/
70
+
71
+ # TypeScript v1 declaration files
72
+ typings/
73
+
74
+ # TypeScript cache
75
+ *.tsbuildinfo
76
+
77
+ # Optional npm cache directory
78
+ .npm
79
+
80
+ # Optional eslint cache
81
+ .eslintcache
82
+
83
+ # Optional REPL history
84
+ .node_repl_history
85
+
86
+ # Output of 'npm pack'
87
+ *.tgz
88
+
89
+ # Yarn Integrity file
90
+ .yarn-integrity
91
+
92
+ # dotenv environment variables file
93
+ .env
94
+ .env.test
95
+
96
+ # parcel-bundler cache (https://parceljs.org/)
97
+ .cache
98
+
99
+ # next.js build output
100
+ .next
101
+
102
+ # nuxt.js build output
103
+ .nuxt
104
+
105
+ # vuepress build output
106
+ .vuepress/dist
107
+
108
+ # Serverless directories
109
+ .serverless/
110
+
111
+ # FuseBox cache
112
+ .fusebox/
113
+
114
+ # DynamoDB Local files
115
+ .dynamodb/
116
+
117
+ ### macOS template
118
+ # General
119
+ .DS_Store
120
+ .AppleDouble
121
+ .LSOverride
122
+
123
+ # Icon must end with two \r
124
+ Icon
125
+
126
+ # Thumbnails
127
+ ._*
128
+
129
+ # Files that might appear in the root of a volume
130
+ .DocumentRevisions-V100
131
+ .fseventsd
132
+ .Spotlight-V100
133
+ .TemporaryItems
134
+ .Trashes
135
+ .VolumeIcon.icns
136
+ .com.apple.timemachine.donotpresent
137
+
138
+ # Directories potentially created on remote AFP share
139
+ .AppleDB
140
+ .AppleDesktop
141
+ Network Trash Folder
142
+ Temporary Items
143
+ .apdisk
144
+
145
+ ### JetBrains template
146
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
147
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
148
+
149
+ # Gradle and Maven with auto-import
150
+ # When using Gradle or Maven with auto-import, you should exclude module files,
151
+ # since they will be recreated, and may cause churn. Uncomment if using
152
+ # auto-import.
153
+ # *.iml
154
+ # *.ipr
155
+
156
+ # CMake
157
+ cmake-build-*/
158
+
159
+ # File-based project format
160
+ *.iws
161
+
162
+ # IntelliJ
163
+ out/
164
+
165
+ # mpeltonen/sbt-idea plugin
166
+ .idea_modules/
167
+
168
+ # JIRA plugin
169
+ atlassian-ide-plugin.xml
170
+
171
+ # Crashlytics plugin (for Android Studio and IntelliJ)
172
+ com_crashlytics_export_strings.xml
173
+ crashlytics.properties
174
+ crashlytics-build.properties
175
+ fabric.properties
176
+
177
+ # Ignore all the yarn.lock files except the one at root
178
+ yarn.lock
179
+ !/yarn.lock
180
+
181
+ .idea
182
+ dist
183
+ /sdk/src
184
+
185
+ .env.*
186
+ /sdk/
187
+ package-lock.json
188
+ /.bundle/
189
+ /.yardoc
190
+ /_yardoc/
191
+ /coverage/
192
+ /doc/
193
+ /pkg/
194
+ /spec/reports/
195
+ /tmp/
196
+ test.rb
197
+ vendor/
198
+ devme-sdk-ruby*.gem
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "colorize", "~> 0.8.1"
4
+ gem "devme-sdk-ruby", "~> 1.0"
5
+ gem "rainbow", "~> 3.1"
6
+
@@ -0,0 +1,23 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ colorize (0.8.1)
5
+ devme-sdk-ruby (1.0.0)
6
+ typhoeus (~> 1.0, >= 1.0.1)
7
+ ethon (0.15.0)
8
+ ffi (>= 1.15.0)
9
+ ffi (1.15.5)
10
+ rainbow (3.1.1)
11
+ typhoeus (1.4.0)
12
+ ethon (>= 0.9.0)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ colorize (~> 0.8.1)
19
+ devme-sdk-ruby (~> 1.0)
20
+ rainbow (~> 3.1)
21
+
22
+ BUNDLED WITH
23
+ 1.17.2
@@ -0,0 +1,20 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'devme-sdk-ruby'
5
+ require 'colorize'
6
+ require 'rainbow'
7
+
8
+ puts Rainbow('This will be printed in red').red
9
+ puts "Hello, world!".colorize(:red)
10
+
11
+ DevmeSdk.configure do |config|
12
+ config.api_key['APIKeyHeader'] = 'demo-key'
13
+ end
14
+ @api_instance = DevmeSdk::CurrencyApi.new
15
+ result = @api_instance.v1_convert_currency(from = 'USD', to = 'EUR', opts = { amount: 10 })
16
+ puts result
17
+
18
+ @api_instance = DevmeSdk::IPApi.new
19
+ result = @api_instance.v1_get_ip_details(opts = { ip: '52.45.23.11' })
20
+ puts result