bubbles-rest-client 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +45 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +85 -0
- data/LICENSE +373 -0
- data/README.md +24 -0
- data/Rakefile +10 -0
- data/bubbles.gemspec +45 -0
- data/fixtures/vcr_cassettes/get_students_authenticated.yml +46 -0
- data/fixtures/vcr_cassettes/get_version_unauthenticated.yml +42 -0
- data/lib/bubbles.rb +650 -0
- data/lib/bubbles/config.rb +201 -0
- data/lib/bubbles/endpoint.rb +181 -0
- data/lib/bubbles/rest_client_resources.rb +124 -0
- data/lib/bubbles/rest_environment.rb +68 -0
- data/lib/bubbles/version.rb +22 -0
- metadata +201 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'addressable/template'
|
2
|
+
|
3
|
+
module Bubbles
|
4
|
+
class RestEnvironment
|
5
|
+
attr_accessor :scheme, :host, :port
|
6
|
+
|
7
|
+
##
|
8
|
+
# Construct a new instance of +RestEnvironment+.
|
9
|
+
#
|
10
|
+
# @param scheme The scheme to use for communicating with the host. Currently, http and https are supported.
|
11
|
+
# @param host The host to communicate with.
|
12
|
+
# @param port The port on which the communication channel should operate.
|
13
|
+
#
|
14
|
+
def initialize(scheme='https', host='api.foamfactory.com', port=443)
|
15
|
+
@scheme = scheme
|
16
|
+
@port = port
|
17
|
+
|
18
|
+
if @scheme == 'http' && @port == 443
|
19
|
+
@port = 80
|
20
|
+
end
|
21
|
+
|
22
|
+
@host = host
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Add an unauthenticated endpoint to this +RestEnvironment+.
|
27
|
+
#
|
28
|
+
# @param type The type of the endpoint. Must be one of [:get].
|
29
|
+
# @param endpoint The path to the endpoint, without the leading slash.
|
30
|
+
#
|
31
|
+
# def add_unauthenticated_endpoint(type, endpoint)
|
32
|
+
# if type == :get
|
33
|
+
# unless endpoint.include? "/"
|
34
|
+
# @endpoints[endpoint] = get_url.expand(scheme: @scheme, environment_host: @host, port: @port, endpoint: endpoint).to_s
|
35
|
+
# return
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# @endpoints[endpoint] = get_url_with_special_endpoint.expand(scheme: @scheme, environment_host: @host, port: @port, endpoint: endpoint).to_s
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# def get_endpoint_string(endpoint)
|
43
|
+
# @endpoints[endpoint]
|
44
|
+
# end
|
45
|
+
|
46
|
+
def get_base_url
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
##
|
52
|
+
# Get an addressable template for a 'special' endpoint (one containing '/' characters)
|
53
|
+
#
|
54
|
+
# @param endpoint The endpoint to get an addressable URL to.
|
55
|
+
#
|
56
|
+
# @returns The ::Addressable::Template without the endpoint parameter encoded in the URI.
|
57
|
+
#
|
58
|
+
# def get_url_with_special_endpoint(endpoint)
|
59
|
+
# special_url_string = '{scheme}://{environment_host}/'
|
60
|
+
# unless @port == 80 || @port == 443
|
61
|
+
# special_url_string = '{scheme}://{environment_host}:{port}/'
|
62
|
+
# end
|
63
|
+
#
|
64
|
+
# special_url_string = special_url_string + endpoint
|
65
|
+
# ::Addressable::Template.new(special_url_string)
|
66
|
+
# end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Bubbles
|
2
|
+
class VersionInformation
|
3
|
+
def self.package_name
|
4
|
+
return 'bubbles-rest-client'
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.version_name
|
8
|
+
'0.0.6'
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.version_code
|
12
|
+
get_code_from_version_name version_name
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.get_code_from_version_name(name)
|
16
|
+
# The version code should be the patch version * 1 + the minor version * 2 + the major version * 4
|
17
|
+
splitVersion = name.split('.')
|
18
|
+
|
19
|
+
4 * splitVersion[0].to_i + 2 * splitVersion[1].to_i + splitVersion[2].to_i
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bubbles-rest-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scott Johnson
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-01-19 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.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
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: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest-reporters
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.16'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.16'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: vcr
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.8'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.8'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: addressable
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.5'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.5'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rest-client
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '2.0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '2.0'
|
153
|
+
description: Retrofit, by Square, allows you to easily define annoations that will
|
154
|
+
generate the necessary boilerplate code for your REST interfaces. Bubbles is a Gem
|
155
|
+
that seeks to bring a similar style of boilerplate generation to Ruby.
|
156
|
+
email: jaywir3@gmail.com
|
157
|
+
executables: []
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- ".gitignore"
|
162
|
+
- Gemfile
|
163
|
+
- Gemfile.lock
|
164
|
+
- LICENSE
|
165
|
+
- README.md
|
166
|
+
- Rakefile
|
167
|
+
- bubbles.gemspec
|
168
|
+
- fixtures/vcr_cassettes/get_students_authenticated.yml
|
169
|
+
- fixtures/vcr_cassettes/get_version_unauthenticated.yml
|
170
|
+
- lib/bubbles.rb
|
171
|
+
- lib/bubbles/config.rb
|
172
|
+
- lib/bubbles/endpoint.rb
|
173
|
+
- lib/bubbles/rest_client_resources.rb
|
174
|
+
- lib/bubbles/rest_environment.rb
|
175
|
+
- lib/bubbles/version.rb
|
176
|
+
homepage: http://www.foamfactorybrewing.com
|
177
|
+
licenses:
|
178
|
+
- MPL-2.0
|
179
|
+
metadata:
|
180
|
+
allowed_push_host: https://rubygems.org
|
181
|
+
post_install_message:
|
182
|
+
rdoc_options: []
|
183
|
+
require_paths:
|
184
|
+
- lib
|
185
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
requirements: []
|
196
|
+
rubyforge_project:
|
197
|
+
rubygems_version: 2.6.8
|
198
|
+
signing_key:
|
199
|
+
specification_version: 4
|
200
|
+
summary: A gem for easily defining client REST interfaces in Ruby
|
201
|
+
test_files: []
|