My-first-api-matic 1.0
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/LICENSE +28 -0
- data/README.md +317 -0
- data/lib/youtube.rb +41 -0
- data/lib/youtube/api_helper.rb +289 -0
- data/lib/youtube/client.rb +34 -0
- data/lib/youtube/configuration.rb +110 -0
- data/lib/youtube/controllers/api_controller.rb +59 -0
- data/lib/youtube/controllers/base_controller.rb +55 -0
- data/lib/youtube/exceptions/api_exception.rb +20 -0
- data/lib/youtube/exceptions/problem_details_exception.rb +44 -0
- data/lib/youtube/http/faraday_client.rb +70 -0
- data/lib/youtube/http/http_call_back.rb +24 -0
- data/lib/youtube/http/http_client.rb +104 -0
- data/lib/youtube/http/http_method_enum.rb +13 -0
- data/lib/youtube/http/http_request.rb +50 -0
- data/lib/youtube/http/http_response.rb +29 -0
- data/lib/youtube/models/base_model.rb +36 -0
- data/lib/youtube/models/field_parameter_validator.rb +80 -0
- data/lib/youtube/models/test_enum.rb +20 -0
- data/lib/youtube/models/weather_forcase_json_imported.rb +62 -0
- data/lib/youtube/models/weather_forecast.rb +63 -0
- data/lib/youtube/utilities/file_wrapper.rb +17 -0
- metadata +147 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
# youtube
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Youtube
|
7
|
+
# HTTP Methods Enumeration.
|
8
|
+
class HttpMethodEnum
|
9
|
+
HTTPMETHODENUM = [GET = 'GET'.freeze, POST = 'POST'.freeze,
|
10
|
+
PUT = 'PUT'.freeze, PATCH = 'PATCH'.freeze,
|
11
|
+
DELETE = 'DELETE'.freeze, HEAD = 'HEAD'.freeze].freeze
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# youtube
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Youtube
|
7
|
+
# Represents a single Http Request.
|
8
|
+
class HttpRequest
|
9
|
+
attr_accessor :http_method, :query_url, :headers,
|
10
|
+
:parameters, :username, :password
|
11
|
+
|
12
|
+
# The constructor.
|
13
|
+
# @param [HttpMethodEnum] The HTTP method.
|
14
|
+
# @param [String] The URL to send the request to.
|
15
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
16
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
17
|
+
def initialize(http_method,
|
18
|
+
query_url,
|
19
|
+
headers: {},
|
20
|
+
parameters: {})
|
21
|
+
@http_method = http_method
|
22
|
+
@query_url = query_url
|
23
|
+
@headers = headers
|
24
|
+
@parameters = parameters
|
25
|
+
end
|
26
|
+
|
27
|
+
# Add a header to the HttpRequest.
|
28
|
+
# @param [String] The name of the header.
|
29
|
+
# @param [String] The value of the header.
|
30
|
+
def add_header(name, value)
|
31
|
+
@headers[name] = value
|
32
|
+
end
|
33
|
+
|
34
|
+
# Add a parameter to the HttpRequest.
|
35
|
+
# @param [String] The name of the parameter.
|
36
|
+
# @param [String] The value of the parameter.
|
37
|
+
def add_parameter(name, value)
|
38
|
+
@parameters[name] = value
|
39
|
+
end
|
40
|
+
|
41
|
+
# Add a query parameter to the HttpRequest.
|
42
|
+
# @param [String] The name of the query parameter.
|
43
|
+
# @param [String] The value of the query parameter.
|
44
|
+
def add_query_parameter(name, value)
|
45
|
+
@query_url = APIHelper.append_url_with_query_parameters(@query_url,
|
46
|
+
name => value)
|
47
|
+
@query_url = APIHelper.clean_url(@query_url)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# youtube
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Youtube
|
7
|
+
# Http response received.
|
8
|
+
class HttpResponse
|
9
|
+
attr_reader :status_code, :reason_phrase, :headers, :raw_body, :request
|
10
|
+
|
11
|
+
# The constructor
|
12
|
+
# @param [Integer] The status code returned by the server.
|
13
|
+
# @param [String] The reason phrase returned by the server.
|
14
|
+
# @param [Hash] The headers sent by the server in the response.
|
15
|
+
# @param [String] The raw body of the response.
|
16
|
+
# @param [HttpRequest] The request that resulted in this response.
|
17
|
+
def initialize(status_code,
|
18
|
+
reason_phrase,
|
19
|
+
headers,
|
20
|
+
raw_body,
|
21
|
+
request)
|
22
|
+
@status_code = status_code
|
23
|
+
@reason_phrase = reason_phrase
|
24
|
+
@headers = headers
|
25
|
+
@raw_body = raw_body
|
26
|
+
@request = request
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# youtube
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Youtube
|
7
|
+
# Base model.
|
8
|
+
class BaseModel
|
9
|
+
# Returns a Hash representation of the current object.
|
10
|
+
def to_hash
|
11
|
+
hash = {}
|
12
|
+
instance_variables.each do |name|
|
13
|
+
value = instance_variable_get(name)
|
14
|
+
name = name[1..-1]
|
15
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
16
|
+
if value.instance_of? Array
|
17
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
18
|
+
elsif value.instance_of? Hash
|
19
|
+
hash[key] = {}
|
20
|
+
value.each do |k, v|
|
21
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
22
|
+
end
|
23
|
+
else
|
24
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
25
|
+
end
|
26
|
+
end
|
27
|
+
hash
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns a JSON representation of the curent object.
|
31
|
+
def to_json(options = {})
|
32
|
+
hash = to_hash
|
33
|
+
hash.to_json(options)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# youtube
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
module Youtube
|
8
|
+
# FieldParameterValidator Model.
|
9
|
+
class FieldParameterValidator < BaseModel
|
10
|
+
# TODO: Write general description for this method
|
11
|
+
# @return [Float]
|
12
|
+
attr_accessor :precision
|
13
|
+
|
14
|
+
# TODO: Write general description for this method
|
15
|
+
# @return [List of String]
|
16
|
+
attr_reader :string
|
17
|
+
|
18
|
+
# TODO: Write general description for this method
|
19
|
+
# @return [DateTime]
|
20
|
+
attr_accessor :unix_format_date_time
|
21
|
+
|
22
|
+
# TODO: Write general description for this method
|
23
|
+
# @return [Object]
|
24
|
+
attr_accessor :object
|
25
|
+
|
26
|
+
# TODO: Write general description for this method
|
27
|
+
# @return [Long]
|
28
|
+
attr_accessor :int64
|
29
|
+
|
30
|
+
# A mapping from model property names to API property names.
|
31
|
+
def self.names
|
32
|
+
@_hash = {} if @_hash.nil?
|
33
|
+
@_hash['precision'] = 'Precision'
|
34
|
+
@_hash['string'] = 'String'
|
35
|
+
@_hash['unix_format_date_time'] = 'UnixFormatDateTime'
|
36
|
+
@_hash['object'] = 'Object'
|
37
|
+
@_hash['int64'] = 'Int64'
|
38
|
+
@_hash
|
39
|
+
end
|
40
|
+
|
41
|
+
def initialize(precision = nil,
|
42
|
+
unix_format_date_time = nil,
|
43
|
+
object = nil,
|
44
|
+
int64 = nil,
|
45
|
+
string = nil)
|
46
|
+
@precision = precision
|
47
|
+
@string = string
|
48
|
+
@unix_format_date_time = unix_format_date_time
|
49
|
+
@object = object
|
50
|
+
@int64 = int64
|
51
|
+
def unix_format_date_time.to_s
|
52
|
+
to_time.utc.to_i.to_s
|
53
|
+
end
|
54
|
+
|
55
|
+
def unix_format_date_time.to_json(_options = {})
|
56
|
+
to_time.utc.to_i.to_json
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Creates an instance of the object from a hash.
|
61
|
+
def self.from_hash(hash)
|
62
|
+
return nil unless hash
|
63
|
+
|
64
|
+
# Extract variables from the hash.
|
65
|
+
precision = hash['Precision']
|
66
|
+
unix_format_date_time = Time.at(hash['UnixFormatDateTime']).utc.to_datetime if
|
67
|
+
hash['UnixFormatDateTime']
|
68
|
+
object = hash['Object']
|
69
|
+
int64 = hash['Int64']
|
70
|
+
string = hash['String']
|
71
|
+
|
72
|
+
# Create object from extracted values.
|
73
|
+
FieldParameterValidator.new(precision,
|
74
|
+
unix_format_date_time,
|
75
|
+
object,
|
76
|
+
int64,
|
77
|
+
string)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# youtube
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Youtube
|
7
|
+
# This is the test description of enum00
|
8
|
+
class TestEnum
|
9
|
+
TEST_ENUM = [
|
10
|
+
# Test description of first filed
|
11
|
+
FIRSTFILED = 22,
|
12
|
+
|
13
|
+
# Test description of Second filed
|
14
|
+
SECONDFIELD = 23,
|
15
|
+
|
16
|
+
# TODO: Write general description for THIRD_VALUE
|
17
|
+
THIRD_VALUE = 66
|
18
|
+
].freeze
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# youtube
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Youtube
|
7
|
+
# WeatherForcaseJsonImported Model.
|
8
|
+
class WeatherForcaseJsonImported < BaseModel
|
9
|
+
# TODO: Write general description for this method
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :date
|
12
|
+
|
13
|
+
# TODO: Write general description for this method
|
14
|
+
# @return [Integer]
|
15
|
+
attr_accessor :temperature_c
|
16
|
+
|
17
|
+
# TODO: Write general description for this method
|
18
|
+
# @return [Integer]
|
19
|
+
attr_accessor :temperature_f
|
20
|
+
|
21
|
+
# TODO: Write general description for this method
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :summary
|
24
|
+
|
25
|
+
# A mapping from model property names to API property names.
|
26
|
+
def self.names
|
27
|
+
@_hash = {} if @_hash.nil?
|
28
|
+
@_hash['date'] = 'date'
|
29
|
+
@_hash['temperature_c'] = 'temperatureC'
|
30
|
+
@_hash['temperature_f'] = 'temperatureF'
|
31
|
+
@_hash['summary'] = 'summary'
|
32
|
+
@_hash
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(date = nil,
|
36
|
+
temperature_c = nil,
|
37
|
+
temperature_f = nil,
|
38
|
+
summary = nil)
|
39
|
+
@date = date
|
40
|
+
@temperature_c = temperature_c
|
41
|
+
@temperature_f = temperature_f
|
42
|
+
@summary = summary
|
43
|
+
end
|
44
|
+
|
45
|
+
# Creates an instance of the object from a hash.
|
46
|
+
def self.from_hash(hash)
|
47
|
+
return nil unless hash
|
48
|
+
|
49
|
+
# Extract variables from the hash.
|
50
|
+
date = hash['date']
|
51
|
+
temperature_c = hash['temperatureC']
|
52
|
+
temperature_f = hash['temperatureF']
|
53
|
+
summary = hash['summary']
|
54
|
+
|
55
|
+
# Create object from extracted values.
|
56
|
+
WeatherForcaseJsonImported.new(date,
|
57
|
+
temperature_c,
|
58
|
+
temperature_f,
|
59
|
+
summary)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# youtube
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
module Youtube
|
8
|
+
# WeatherForecast Model.
|
9
|
+
class WeatherForecast < BaseModel
|
10
|
+
# The time when forecast was taken
|
11
|
+
# @return [DateTime]
|
12
|
+
attr_accessor :date
|
13
|
+
|
14
|
+
# the value of temperature in Centigrade
|
15
|
+
# @return [Integer]
|
16
|
+
attr_accessor :temperature_c
|
17
|
+
|
18
|
+
# the value of temperature in Fahrenheit
|
19
|
+
# @return [Integer]
|
20
|
+
attr_reader :temperature_f
|
21
|
+
|
22
|
+
# the value of temperature in Fahrenheit
|
23
|
+
# @return [String]
|
24
|
+
attr_reader :summary
|
25
|
+
|
26
|
+
# A mapping from model property names to API property names.
|
27
|
+
def self.names
|
28
|
+
@_hash = {} if @_hash.nil?
|
29
|
+
@_hash['date'] = 'date'
|
30
|
+
@_hash['temperature_c'] = 'temperatureC'
|
31
|
+
@_hash['temperature_f'] = 'temperatureF'
|
32
|
+
@_hash['summary'] = 'summary'
|
33
|
+
@_hash
|
34
|
+
end
|
35
|
+
|
36
|
+
def initialize(date = nil,
|
37
|
+
temperature_c = nil,
|
38
|
+
temperature_f = nil,
|
39
|
+
summary = nil)
|
40
|
+
@date = date
|
41
|
+
@temperature_c = temperature_c
|
42
|
+
@temperature_f = temperature_f
|
43
|
+
@summary = summary
|
44
|
+
end
|
45
|
+
|
46
|
+
# Creates an instance of the object from a hash.
|
47
|
+
def self.from_hash(hash)
|
48
|
+
return nil unless hash
|
49
|
+
|
50
|
+
# Extract variables from the hash.
|
51
|
+
date = APIHelper.rfc3339(hash['date']) if hash['date']
|
52
|
+
temperature_c = hash['temperatureC']
|
53
|
+
temperature_f = hash['temperatureF']
|
54
|
+
summary = hash['summary']
|
55
|
+
|
56
|
+
# Create object from extracted values.
|
57
|
+
WeatherForecast.new(date,
|
58
|
+
temperature_c,
|
59
|
+
temperature_f,
|
60
|
+
summary)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# youtube
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Youtube
|
7
|
+
# A utility to allow users to set the content-type for files
|
8
|
+
class FileWrapper
|
9
|
+
attr_reader :content_type
|
10
|
+
attr_reader :file
|
11
|
+
|
12
|
+
def initialize(file, content_type: 'application/octet-stream')
|
13
|
+
@file = file
|
14
|
+
@content_type = content_type
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: My-first-api-matic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- APIMatic SDK Generator
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-06-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: logging
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
- - "<="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.3.0
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.0'
|
44
|
+
- - "<="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.3.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: faraday_middleware
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: certifi
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '2018.1'
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 2018.01.18
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2018.1'
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 2018.01.18
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: faraday-http-cache
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '2.2'
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '2.2'
|
95
|
+
description: ''
|
96
|
+
email: support@apimatic.io
|
97
|
+
executables: []
|
98
|
+
extensions: []
|
99
|
+
extra_rdoc_files: []
|
100
|
+
files:
|
101
|
+
- LICENSE
|
102
|
+
- README.md
|
103
|
+
- lib/youtube.rb
|
104
|
+
- lib/youtube/api_helper.rb
|
105
|
+
- lib/youtube/client.rb
|
106
|
+
- lib/youtube/configuration.rb
|
107
|
+
- lib/youtube/controllers/api_controller.rb
|
108
|
+
- lib/youtube/controllers/base_controller.rb
|
109
|
+
- lib/youtube/exceptions/api_exception.rb
|
110
|
+
- lib/youtube/exceptions/problem_details_exception.rb
|
111
|
+
- lib/youtube/http/faraday_client.rb
|
112
|
+
- lib/youtube/http/http_call_back.rb
|
113
|
+
- lib/youtube/http/http_client.rb
|
114
|
+
- lib/youtube/http/http_method_enum.rb
|
115
|
+
- lib/youtube/http/http_request.rb
|
116
|
+
- lib/youtube/http/http_response.rb
|
117
|
+
- lib/youtube/models/base_model.rb
|
118
|
+
- lib/youtube/models/field_parameter_validator.rb
|
119
|
+
- lib/youtube/models/test_enum.rb
|
120
|
+
- lib/youtube/models/weather_forcase_json_imported.rb
|
121
|
+
- lib/youtube/models/weather_forecast.rb
|
122
|
+
- lib/youtube/utilities/file_wrapper.rb
|
123
|
+
homepage: https://apimatic.io
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '2.0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubyforge_project:
|
143
|
+
rubygems_version: 2.7.6
|
144
|
+
signing_key:
|
145
|
+
specification_version: 4
|
146
|
+
summary: youtube
|
147
|
+
test_files: []
|