weather_API_Assignment 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 +187 -0
- data/lib/weather_api_assignment.rb +46 -0
- data/lib/weather_api_assignment/api_helper.rb +275 -0
- data/lib/weather_api_assignment/configuration.rb +24 -0
- data/lib/weather_api_assignment/controllers/base_controller.rb +51 -0
- data/lib/weather_api_assignment/controllers/weather_ap_is_controller.rb +121 -0
- data/lib/weather_api_assignment/exceptions/api_exception.rb +20 -0
- data/lib/weather_api_assignment/http/auth/custom_query_auth.rb +16 -0
- data/lib/weather_api_assignment/http/faraday_client.rb +64 -0
- data/lib/weather_api_assignment/http/http_call_back.rb +24 -0
- data/lib/weather_api_assignment/http/http_client.rb +104 -0
- data/lib/weather_api_assignment/http/http_context.rb +20 -0
- data/lib/weather_api_assignment/http/http_method_enum.rb +13 -0
- data/lib/weather_api_assignment/http/http_request.rb +50 -0
- data/lib/weather_api_assignment/http/http_response.rb +23 -0
- data/lib/weather_api_assignment/models/base_model.rb +36 -0
- data/lib/weather_api_assignment/models/clouds.rb +35 -0
- data/lib/weather_api_assignment/models/coord.rb +44 -0
- data/lib/weather_api_assignment/models/lang_enum.rb +20 -0
- data/lib/weather_api_assignment/models/main.rb +98 -0
- data/lib/weather_api_assignment/models/mode_enum.rb +20 -0
- data/lib/weather_api_assignment/models/sys.rb +80 -0
- data/lib/weather_api_assignment/models/units_enum.rb +20 -0
- data/lib/weather_api_assignment/models/weather.rb +62 -0
- data/lib/weather_api_assignment/models/weather_api_response.rb +150 -0
- data/lib/weather_api_assignment/models/wind.rb +44 -0
- data/lib/weather_api_assignment/weather_api_assignment_client.rb +27 -0
- metadata +167 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
# weather_api_assignment
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC
|
4
|
+
# v2.0 ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WeatherApiAssignment
|
7
|
+
# This model contains the weather information
|
8
|
+
class Weather < BaseModel
|
9
|
+
# This field contains the identifier
|
10
|
+
# @return [Integer]
|
11
|
+
attr_accessor :id
|
12
|
+
|
13
|
+
# This field contains the type of weather.
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :main
|
16
|
+
|
17
|
+
# This field contains the description of weather type in detail
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :description
|
20
|
+
|
21
|
+
# This field contains icon
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :icon
|
24
|
+
|
25
|
+
# A mapping from model property names to API property names.
|
26
|
+
def self.names
|
27
|
+
@_hash = {} if @_hash.nil?
|
28
|
+
@_hash['id'] = 'id'
|
29
|
+
@_hash['main'] = 'main'
|
30
|
+
@_hash['description'] = 'description'
|
31
|
+
@_hash['icon'] = 'icon'
|
32
|
+
@_hash
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(id = nil,
|
36
|
+
main = nil,
|
37
|
+
description = nil,
|
38
|
+
icon = nil)
|
39
|
+
@id = id
|
40
|
+
@main = main
|
41
|
+
@description = description
|
42
|
+
@icon = icon
|
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
|
+
id = hash['id']
|
51
|
+
main = hash['main']
|
52
|
+
description = hash['description']
|
53
|
+
icon = hash['icon']
|
54
|
+
|
55
|
+
# Create object from extracted values.
|
56
|
+
Weather.new(id,
|
57
|
+
main,
|
58
|
+
description,
|
59
|
+
icon)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# weather_api_assignment
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC
|
4
|
+
# v2.0 ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WeatherApiAssignment
|
7
|
+
# Weather API overall response model
|
8
|
+
class WeatherAPIResponse < BaseModel
|
9
|
+
# This field contains information of longitude and latitude
|
10
|
+
# @return [Coord]
|
11
|
+
attr_accessor :coord
|
12
|
+
|
13
|
+
# This field contains list of weather information object
|
14
|
+
# @return [List of Weather]
|
15
|
+
attr_accessor :weather
|
16
|
+
|
17
|
+
# This field contains the base
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :base
|
20
|
+
|
21
|
+
# This field contains the digital stats of current weather
|
22
|
+
# @return [Main]
|
23
|
+
attr_accessor :main
|
24
|
+
|
25
|
+
# This field contains the visibility value
|
26
|
+
# @return [Long]
|
27
|
+
attr_accessor :visibility
|
28
|
+
|
29
|
+
# This field contains the wind information of current weather
|
30
|
+
# @return [Wind]
|
31
|
+
attr_accessor :wind
|
32
|
+
|
33
|
+
# This field contains the information about clouds
|
34
|
+
# @return [Clouds]
|
35
|
+
attr_accessor :clouds
|
36
|
+
|
37
|
+
# This is current date and time
|
38
|
+
# @return [Long]
|
39
|
+
attr_accessor :dt
|
40
|
+
|
41
|
+
# This field contains information about country, sunrise and sunset
|
42
|
+
# @return [Sys]
|
43
|
+
attr_accessor :sys
|
44
|
+
|
45
|
+
# This is an identifier
|
46
|
+
# @return [Long]
|
47
|
+
attr_accessor :id
|
48
|
+
|
49
|
+
# This is the name of city
|
50
|
+
# @return [String]
|
51
|
+
attr_accessor :name
|
52
|
+
|
53
|
+
# This information is about cod
|
54
|
+
# @return [Integer]
|
55
|
+
attr_accessor :cod
|
56
|
+
|
57
|
+
# This field contains information of time zone Id of city
|
58
|
+
# @return [Integer]
|
59
|
+
attr_accessor :timezone
|
60
|
+
|
61
|
+
# A mapping from model property names to API property names.
|
62
|
+
def self.names
|
63
|
+
@_hash = {} if @_hash.nil?
|
64
|
+
@_hash['coord'] = 'coord'
|
65
|
+
@_hash['weather'] = 'weather'
|
66
|
+
@_hash['base'] = 'base'
|
67
|
+
@_hash['main'] = 'main'
|
68
|
+
@_hash['visibility'] = 'visibility'
|
69
|
+
@_hash['wind'] = 'wind'
|
70
|
+
@_hash['clouds'] = 'clouds'
|
71
|
+
@_hash['dt'] = 'dt'
|
72
|
+
@_hash['sys'] = 'sys'
|
73
|
+
@_hash['id'] = 'id'
|
74
|
+
@_hash['name'] = 'name'
|
75
|
+
@_hash['cod'] = 'cod'
|
76
|
+
@_hash['timezone'] = 'timezone'
|
77
|
+
@_hash
|
78
|
+
end
|
79
|
+
|
80
|
+
def initialize(coord = nil,
|
81
|
+
weather = nil,
|
82
|
+
base = nil,
|
83
|
+
main = nil,
|
84
|
+
wind = nil,
|
85
|
+
clouds = nil,
|
86
|
+
dt = nil,
|
87
|
+
sys = nil,
|
88
|
+
id = nil,
|
89
|
+
name = nil,
|
90
|
+
cod = nil,
|
91
|
+
visibility = nil,
|
92
|
+
timezone = nil)
|
93
|
+
@coord = coord
|
94
|
+
@weather = weather
|
95
|
+
@base = base
|
96
|
+
@main = main
|
97
|
+
@visibility = visibility
|
98
|
+
@wind = wind
|
99
|
+
@clouds = clouds
|
100
|
+
@dt = dt
|
101
|
+
@sys = sys
|
102
|
+
@id = id
|
103
|
+
@name = name
|
104
|
+
@cod = cod
|
105
|
+
@timezone = timezone
|
106
|
+
end
|
107
|
+
|
108
|
+
# Creates an instance of the object from a hash.
|
109
|
+
def self.from_hash(hash)
|
110
|
+
return nil unless hash
|
111
|
+
|
112
|
+
# Extract variables from the hash.
|
113
|
+
coord = Coord.from_hash(hash['coord']) if hash['coord']
|
114
|
+
# Parameter is an array, so we need to iterate through it
|
115
|
+
weather = nil
|
116
|
+
unless hash['weather'].nil?
|
117
|
+
weather = []
|
118
|
+
hash['weather'].each do |structure|
|
119
|
+
weather << (Weather.from_hash(structure) if structure)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
base = hash['base']
|
123
|
+
main = Main.from_hash(hash['main']) if hash['main']
|
124
|
+
wind = Wind.from_hash(hash['wind']) if hash['wind']
|
125
|
+
clouds = Clouds.from_hash(hash['clouds']) if hash['clouds']
|
126
|
+
dt = hash['dt']
|
127
|
+
sys = Sys.from_hash(hash['sys']) if hash['sys']
|
128
|
+
id = hash['id']
|
129
|
+
name = hash['name']
|
130
|
+
cod = hash['cod']
|
131
|
+
visibility = hash['visibility']
|
132
|
+
timezone = hash['timezone']
|
133
|
+
|
134
|
+
# Create object from extracted values.
|
135
|
+
WeatherAPIResponse.new(coord,
|
136
|
+
weather,
|
137
|
+
base,
|
138
|
+
main,
|
139
|
+
wind,
|
140
|
+
clouds,
|
141
|
+
dt,
|
142
|
+
sys,
|
143
|
+
id,
|
144
|
+
name,
|
145
|
+
cod,
|
146
|
+
visibility,
|
147
|
+
timezone)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# weather_api_assignment
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC
|
4
|
+
# v2.0 ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WeatherApiAssignment
|
7
|
+
# This model contains information of wind stats.
|
8
|
+
class Wind < BaseModel
|
9
|
+
# This field contains the wind speed
|
10
|
+
# @return [Float]
|
11
|
+
attr_accessor :speed
|
12
|
+
|
13
|
+
# This field contains the direction of wind
|
14
|
+
# @return [Float]
|
15
|
+
attr_accessor :deg
|
16
|
+
|
17
|
+
# A mapping from model property names to API property names.
|
18
|
+
def self.names
|
19
|
+
@_hash = {} if @_hash.nil?
|
20
|
+
@_hash['speed'] = 'speed'
|
21
|
+
@_hash['deg'] = 'deg'
|
22
|
+
@_hash
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(speed = nil,
|
26
|
+
deg = nil)
|
27
|
+
@speed = speed
|
28
|
+
@deg = deg
|
29
|
+
end
|
30
|
+
|
31
|
+
# Creates an instance of the object from a hash.
|
32
|
+
def self.from_hash(hash)
|
33
|
+
return nil unless hash
|
34
|
+
|
35
|
+
# Extract variables from the hash.
|
36
|
+
speed = hash['speed']
|
37
|
+
deg = hash['deg']
|
38
|
+
|
39
|
+
# Create object from extracted values.
|
40
|
+
Wind.new(speed,
|
41
|
+
deg)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# weather_api_assignment
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC
|
4
|
+
# v2.0 ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module WeatherApiAssignment
|
7
|
+
# weather_api_assignment client class.
|
8
|
+
class WeatherApiAssignmentClient
|
9
|
+
# Singleton access to weather_ap_is controller.
|
10
|
+
# @return [WeatherAPIsController] Returns the controller instance.
|
11
|
+
def weather_ap_is
|
12
|
+
WeatherAPIsController.instance
|
13
|
+
end
|
14
|
+
|
15
|
+
# Returns the configuration class for easy access.
|
16
|
+
# @return [Configuration] Returns the actual configuration class.
|
17
|
+
def config
|
18
|
+
Configuration
|
19
|
+
end
|
20
|
+
|
21
|
+
# Initializer with authentication and configuration parameters.
|
22
|
+
def initialize(appid: '178db63aed00f6e4daaa06009b04438b')
|
23
|
+
Configuration.appid = appid if
|
24
|
+
appid
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: weather_API_Assignment
|
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: 2020-12-16 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.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.10'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday_middleware
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.13.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.13.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test-unit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.1'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 3.1.5
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '3.1'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 3.1.5
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: certifi
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '2016'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '2016'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: faraday-http-cache
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.2'
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.2.2
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '1.2'
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 1.2.2
|
109
|
+
description: This API will provide latest information of current weather
|
110
|
+
email: support@apimatic.io
|
111
|
+
executables: []
|
112
|
+
extensions: []
|
113
|
+
extra_rdoc_files: []
|
114
|
+
files:
|
115
|
+
- LICENSE
|
116
|
+
- README.md
|
117
|
+
- lib/weather_api_assignment.rb
|
118
|
+
- lib/weather_api_assignment/api_helper.rb
|
119
|
+
- lib/weather_api_assignment/configuration.rb
|
120
|
+
- lib/weather_api_assignment/controllers/base_controller.rb
|
121
|
+
- lib/weather_api_assignment/controllers/weather_ap_is_controller.rb
|
122
|
+
- lib/weather_api_assignment/exceptions/api_exception.rb
|
123
|
+
- lib/weather_api_assignment/http/auth/custom_query_auth.rb
|
124
|
+
- lib/weather_api_assignment/http/faraday_client.rb
|
125
|
+
- lib/weather_api_assignment/http/http_call_back.rb
|
126
|
+
- lib/weather_api_assignment/http/http_client.rb
|
127
|
+
- lib/weather_api_assignment/http/http_context.rb
|
128
|
+
- lib/weather_api_assignment/http/http_method_enum.rb
|
129
|
+
- lib/weather_api_assignment/http/http_request.rb
|
130
|
+
- lib/weather_api_assignment/http/http_response.rb
|
131
|
+
- lib/weather_api_assignment/models/base_model.rb
|
132
|
+
- lib/weather_api_assignment/models/clouds.rb
|
133
|
+
- lib/weather_api_assignment/models/coord.rb
|
134
|
+
- lib/weather_api_assignment/models/lang_enum.rb
|
135
|
+
- lib/weather_api_assignment/models/main.rb
|
136
|
+
- lib/weather_api_assignment/models/mode_enum.rb
|
137
|
+
- lib/weather_api_assignment/models/sys.rb
|
138
|
+
- lib/weather_api_assignment/models/units_enum.rb
|
139
|
+
- lib/weather_api_assignment/models/weather.rb
|
140
|
+
- lib/weather_api_assignment/models/weather_api_response.rb
|
141
|
+
- lib/weather_api_assignment/models/wind.rb
|
142
|
+
- lib/weather_api_assignment/weather_api_assignment_client.rb
|
143
|
+
homepage: https://apimatic.io
|
144
|
+
licenses:
|
145
|
+
- MIT
|
146
|
+
metadata: {}
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - "~>"
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '2.0'
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 2.7.6
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: weather_api_assignment
|
167
|
+
test_files: []
|