rapidapi 0.1.1
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 +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +0 -0
- data/Rakefile +6 -0
- data/bin/console +7 -0
- data/bin/setup +8 -0
- data/lib/rapidapi/config.rb +20 -0
- data/lib/rapidapi/version.rb +3 -0
- data/lib/rapidapisdk.rb +44 -0
- data/rapidapi.gemspec +29 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 01b14bc1e880d4594f2b67229d36bc10eb278926
|
4
|
+
data.tar.gz: 40f5aa9ebe55980f05d01773c530a915dafa059f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 94d36fe4917b65a016453bd1dc4d5219fe09cc3a7907a51eb16983edc8e21778fa08d238198fefd2348684525335c2fd2b0f93b1c8c0dbc28e53e57c2c7bd74a
|
7
|
+
data.tar.gz: 762de32d4dd3b08021a037c30f082f11d492fc9d761ba7fd32cc66b0ae680d163510f10ae338416e2b57615002dd30bac57cf9137eb3f25e8feea0cac143223f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 TODO: Write your name
|
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
File without changes
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
class MissingCredentialsError < RuntimeError
|
4
|
+
end
|
5
|
+
|
6
|
+
class RapidAPI::Config
|
7
|
+
def self.setup(**args)
|
8
|
+
@@project = args[:project]
|
9
|
+
@@api_key = args[:api_key]
|
10
|
+
return
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.project
|
14
|
+
@@project || raise(MissingCredentialsError, 'Project name not set')
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.api_key
|
18
|
+
@@api_key || raise(MissingCredentialsError, 'API key not set')
|
19
|
+
end
|
20
|
+
end
|
data/lib/rapidapisdk.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'net/http/post/multipart'
|
3
|
+
require 'json'
|
4
|
+
require 'rapidapi/version'
|
5
|
+
require 'rapidapi/config'
|
6
|
+
|
7
|
+
module RapidAPI
|
8
|
+
class << self
|
9
|
+
|
10
|
+
def config(**args)
|
11
|
+
RapidAPI::Config.setup(args)
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(package_name, block_name, args={})
|
15
|
+
|
16
|
+
uri = build_uri(package_name, block_name)
|
17
|
+
req = build_request(uri, args)
|
18
|
+
res = Net::HTTP.start(uri.hostname, uri.port) { |http|
|
19
|
+
http.request(req)
|
20
|
+
}
|
21
|
+
reply = JSON.parse(res.body)
|
22
|
+
|
23
|
+
unless res.code.to_i == 200
|
24
|
+
reply['outcome'] = 'error'
|
25
|
+
end
|
26
|
+
|
27
|
+
reply
|
28
|
+
end
|
29
|
+
|
30
|
+
def build_uri(package, block)
|
31
|
+
URI("http://rapidapi.io/connect/#{package}/#{block}")
|
32
|
+
end
|
33
|
+
|
34
|
+
def build_request(uri, form_data)
|
35
|
+
|
36
|
+
config = RapidAPI::Config
|
37
|
+
|
38
|
+
req = Net::HTTP::Post::Multipart.new(uri, form_data)
|
39
|
+
req.basic_auth(config.project, config.api_key)
|
40
|
+
|
41
|
+
req
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/rapidapi.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rapidapi/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'rapidapi'
|
8
|
+
spec.version = RapidAPI::VERSION
|
9
|
+
spec.authors = ['Andrey Bukati']
|
10
|
+
spec.email = ['andrey@rapidapi.com']
|
11
|
+
|
12
|
+
spec.summary = %q{Find, try and connect to APIs easily with the RapidAPI marketplace}
|
13
|
+
spec.description = %q{This Gem allows you to use RapidAPI in your application.}
|
14
|
+
spec.homepage = 'https://github.com/RapidSoftwareSolutions/rapidapi-ruby-sdk'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = 'exe'
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
|
+
spec.add_development_dependency 'byebug', '~> 9.0', '>= 9.0.6'
|
28
|
+
spec.add_development_dependency 'multipart-post', '~> 2.0'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rapidapi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrey Bukati
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '9.0'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 9.0.6
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '9.0'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 9.0.6
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: multipart-post
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '2.0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '2.0'
|
89
|
+
description: This Gem allows you to use RapidAPI in your application.
|
90
|
+
email:
|
91
|
+
- andrey@rapidapi.com
|
92
|
+
executables: []
|
93
|
+
extensions: []
|
94
|
+
extra_rdoc_files: []
|
95
|
+
files:
|
96
|
+
- ".gitignore"
|
97
|
+
- ".rspec"
|
98
|
+
- Gemfile
|
99
|
+
- LICENSE.txt
|
100
|
+
- README.md
|
101
|
+
- Rakefile
|
102
|
+
- bin/console
|
103
|
+
- bin/setup
|
104
|
+
- lib/rapidapi/config.rb
|
105
|
+
- lib/rapidapi/version.rb
|
106
|
+
- lib/rapidapisdk.rb
|
107
|
+
- rapidapi.gemspec
|
108
|
+
homepage: https://github.com/RapidSoftwareSolutions/rapidapi-ruby-sdk
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.5.1
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Find, try and connect to APIs easily with the RapidAPI marketplace
|
132
|
+
test_files: []
|