visualization-js-api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,47 @@
1
+ =begin
2
+ #Visualization API
3
+
4
+ #Generates server side renderings of D3 visualizations for a nodejs backend
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ module VisualizationJsApi
25
+ class ApiError < StandardError
26
+ attr_reader :code, :response_headers, :response_body
27
+
28
+ # Usage examples:
29
+ # ApiError.new
30
+ # ApiError.new("message")
31
+ # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
32
+ # ApiError.new(:code => 404, :message => "Not Found")
33
+ def initialize(arg = nil)
34
+ if arg.is_a? Hash
35
+ arg.each do |k, v|
36
+ if k.to_s == 'message'
37
+ super v
38
+ else
39
+ instance_variable_set "@#{k}", v
40
+ end
41
+ end
42
+ else
43
+ super arg
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,207 @@
1
+ =begin
2
+ #Visualization API
3
+
4
+ #Generates server side renderings of D3 visualizations for a nodejs backend
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'uri'
25
+
26
+ module VisualizationJsApi
27
+ class Configuration
28
+ # Defines url scheme
29
+ attr_accessor :scheme
30
+
31
+ # Defines url host
32
+ attr_accessor :host
33
+
34
+ # Defines url base path
35
+ attr_accessor :base_path
36
+
37
+ # Defines API keys used with API Key authentications.
38
+ #
39
+ # @return [Hash] key: parameter name, value: parameter value (API key)
40
+ #
41
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
42
+ # config.api_key['api_key'] = 'xxx'
43
+ attr_accessor :api_key
44
+
45
+ # Defines API key prefixes used with API Key authentications.
46
+ #
47
+ # @return [Hash] key: parameter name, value: API key prefix
48
+ #
49
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
50
+ # config.api_key_prefix['api_key'] = 'Token'
51
+ attr_accessor :api_key_prefix
52
+
53
+ # Defines the username used with HTTP basic authentication.
54
+ #
55
+ # @return [String]
56
+ attr_accessor :username
57
+
58
+ # Defines the password used with HTTP basic authentication.
59
+ #
60
+ # @return [String]
61
+ attr_accessor :password
62
+
63
+ # Defines the access token (Bearer) used with OAuth2.
64
+ attr_accessor :access_token
65
+
66
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
67
+ # details will be logged with `logger.debug` (see the `logger` attribute).
68
+ # Default to false.
69
+ #
70
+ # @return [true, false]
71
+ attr_accessor :debugging
72
+
73
+ # Defines the logger used for debugging.
74
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
75
+ #
76
+ # @return [#debug]
77
+ attr_accessor :logger
78
+
79
+ # Defines the temporary folder to store downloaded files
80
+ # (for API endpoints that have file response).
81
+ # Default to use `Tempfile`.
82
+ #
83
+ # @return [String]
84
+ attr_accessor :temp_folder_path
85
+
86
+ # The time limit for HTTP request in seconds.
87
+ # Default to 0 (never times out).
88
+ attr_accessor :timeout
89
+
90
+ ### TLS/SSL setting
91
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
92
+ # Default to true.
93
+ #
94
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
95
+ #
96
+ # @return [true, false]
97
+ attr_accessor :verify_ssl
98
+
99
+ ### TLS/SSL setting
100
+ # Set this to false to skip verifying SSL host name
101
+ # Default to true.
102
+ #
103
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
104
+ #
105
+ # @return [true, false]
106
+ attr_accessor :verify_ssl_host
107
+
108
+ ### TLS/SSL setting
109
+ # Set this to customize the certificate file to verify the peer.
110
+ #
111
+ # @return [String] the path to the certificate file
112
+ #
113
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
114
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
115
+ attr_accessor :ssl_ca_cert
116
+
117
+ ### TLS/SSL setting
118
+ # Client certificate file (for client certificate)
119
+ attr_accessor :cert_file
120
+
121
+ ### TLS/SSL setting
122
+ # Client private key file (for client certificate)
123
+ attr_accessor :key_file
124
+
125
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
126
+ # Default to nil.
127
+ #
128
+ # @see The params_encoding option of Ethon. Related source code:
129
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
130
+ attr_accessor :params_encoding
131
+
132
+ attr_accessor :inject_format
133
+
134
+ attr_accessor :force_ending_format
135
+
136
+ def initialize
137
+ @scheme = 'https'
138
+ @host = 'localhost:8000'
139
+ @base_path = '/api/v1'
140
+ @api_key = {}
141
+ @api_key_prefix = {}
142
+ @timeout = 0
143
+ @verify_ssl = true
144
+ @verify_ssl_host = true
145
+ @params_encoding = nil
146
+ @cert_file = nil
147
+ @key_file = nil
148
+ @debugging = false
149
+ @inject_format = false
150
+ @force_ending_format = false
151
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
152
+
153
+ yield(self) if block_given?
154
+ end
155
+
156
+ # The default Configuration object.
157
+ def self.default
158
+ @@default ||= Configuration.new
159
+ end
160
+
161
+ def configure
162
+ yield(self) if block_given?
163
+ end
164
+
165
+ def scheme=(scheme)
166
+ # remove :// from scheme
167
+ @scheme = scheme.sub(/:\/\//, '')
168
+ end
169
+
170
+ def host=(host)
171
+ # remove http(s):// and anything after a slash
172
+ @host = host.sub(/https?:\/\//, '').split('/').first
173
+ end
174
+
175
+ def base_path=(base_path)
176
+ # Add leading and trailing slashes to base_path
177
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
178
+ @base_path = "" if @base_path == "/"
179
+ end
180
+
181
+ def base_url
182
+ url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
183
+ URI.encode(url)
184
+ end
185
+
186
+ # Gets API key (with prefix if set).
187
+ # @param [String] param_name the parameter name of API key auth
188
+ def api_key_with_prefix(param_name)
189
+ if @api_key_prefix[param_name]
190
+ "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
191
+ else
192
+ @api_key[param_name]
193
+ end
194
+ end
195
+
196
+ # Gets Basic Auth token string
197
+ def basic_auth_token
198
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
199
+ end
200
+
201
+ # Returns Auth Settings hash for api client.
202
+ def auth_settings
203
+ {
204
+ }
205
+ end
206
+ end
207
+ end
@@ -0,0 +1,208 @@
1
+ =begin
2
+ #Visualization API
3
+
4
+ #Generates server side renderings of D3 visualizations for a nodejs backend
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module VisualizationJsApi
27
+
28
+ class GraphDefinition
29
+ attr_accessor :graph
30
+
31
+ attr_accessor :graph_options
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'graph' => :'graph',
38
+ :'graph_options' => :'graph_options'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.swagger_types
44
+ {
45
+ :'graph' => :'GraphDefinitionGraph',
46
+ :'graph_options' => :'GraphDefinitionGraphOptions'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
57
+
58
+ if attributes.has_key?(:'graph')
59
+ self.graph = attributes[:'graph']
60
+ end
61
+
62
+ if attributes.has_key?(:'graph_options')
63
+ self.graph_options = attributes[:'graph_options']
64
+ end
65
+
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properies with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ return invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ return true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ graph == o.graph &&
87
+ graph_options == o.graph_options
88
+ end
89
+
90
+ # @see the `==` method
91
+ # @param [Object] Object to be compared
92
+ def eql?(o)
93
+ self == o
94
+ end
95
+
96
+ # Calculates hash code according to all attributes.
97
+ # @return [Fixnum] Hash code
98
+ def hash
99
+ [graph, graph_options].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.swagger_types.each_pair do |key, type|
108
+ if type =~ /^Array<(.*)>/i
109
+ # check to ensure the input is an array given that the the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
113
+ end
114
+ elsif !attributes[self.class.attribute_map[key]].nil?
115
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ # Deserializes the data based on type
123
+ # @param string type Data type
124
+ # @param string value Value to be deserialized
125
+ # @return [Object] Deserialized data
126
+ def _deserialize(type, value)
127
+ case type.to_sym
128
+ when :DateTime
129
+ DateTime.parse(value)
130
+ when :Date
131
+ Date.parse(value)
132
+ when :String
133
+ value.to_s
134
+ when :Integer
135
+ value.to_i
136
+ when :Float
137
+ value.to_f
138
+ when :BOOLEAN
139
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
140
+ true
141
+ else
142
+ false
143
+ end
144
+ when :Object
145
+ # generic object (usually a Hash), return directly
146
+ value
147
+ when /\AArray<(?<inner_type>.+)>\z/
148
+ inner_type = Regexp.last_match[:inner_type]
149
+ value.map { |v| _deserialize(inner_type, v) }
150
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
151
+ k_type = Regexp.last_match[:k_type]
152
+ v_type = Regexp.last_match[:v_type]
153
+ {}.tap do |hash|
154
+ value.each do |k, v|
155
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
156
+ end
157
+ end
158
+ else # model
159
+ temp_model = VisualizationJsApi.const_get(type).new
160
+ temp_model.build_from_hash(value)
161
+ end
162
+ end
163
+
164
+ # Returns the string representation of the object
165
+ # @return [String] String presentation of the object
166
+ def to_s
167
+ to_hash.to_s
168
+ end
169
+
170
+ # to_body is an alias to to_hash (backward compatibility)
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_body
173
+ to_hash
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = self.send(attr)
182
+ next if value.nil?
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ # Outputs non-array value in the form of hash
189
+ # For object, use to_hash. Otherwise, just return the value
190
+ # @param [Object] value Any valid value
191
+ # @return [Hash] Returns the value in the form of hash
192
+ def _to_hash(value)
193
+ if value.is_a?(Array)
194
+ value.compact.map{ |v| _to_hash(v) }
195
+ elsif value.is_a?(Hash)
196
+ {}.tap do |hash|
197
+ value.each { |k, v| hash[k] = _to_hash(v) }
198
+ end
199
+ elsif value.respond_to? :to_hash
200
+ value.to_hash
201
+ else
202
+ value
203
+ end
204
+ end
205
+
206
+ end
207
+
208
+ end