weather_api_task 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,23 @@
1
+ # weather_api_task
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WeatherApiTask
7
+ # Http response received.
8
+ class HttpResponse
9
+ attr_accessor :status_code, :headers, :raw_body
10
+
11
+ # The constructor
12
+ # @param [Integer] The status code returned by the server.
13
+ # @param [Hash] The headers sent by the server in the response.
14
+ # @param [String] The raw body of the response.
15
+ def initialize(status_code,
16
+ headers,
17
+ raw_body)
18
+ @status_code = status_code
19
+ @headers = headers
20
+ @raw_body = raw_body
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,36 @@
1
+ # weather_api_task
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WeatherApiTask
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,69 @@
1
+ # weather_api_task
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WeatherApiTask
7
+ # CityWeather Model.
8
+ class CityWeather < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :message
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :cod
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [Integer]
19
+ attr_accessor :count
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [List of List]
23
+ attr_accessor :list
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['message'] = 'message'
29
+ @_hash['cod'] = 'cod'
30
+ @_hash['count'] = 'count'
31
+ @_hash['list'] = 'list'
32
+ @_hash
33
+ end
34
+
35
+ def initialize(message = nil,
36
+ cod = nil,
37
+ count = nil,
38
+ list = nil)
39
+ @message = message
40
+ @cod = cod
41
+ @count = count
42
+ @list = list
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
+ message = hash['message']
51
+ cod = hash['cod']
52
+ count = hash['count']
53
+ # Parameter is an array, so we need to iterate through it
54
+ list = nil
55
+ unless hash['list'].nil?
56
+ list = []
57
+ hash['list'].each do |structure|
58
+ list << (List.from_hash(structure) if structure)
59
+ end
60
+ end
61
+
62
+ # Create object from extracted values.
63
+ CityWeather.new(message,
64
+ cod,
65
+ count,
66
+ list)
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,35 @@
1
+ # weather_api_task
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WeatherApiTask
7
+ # Clouds Model.
8
+ class Clouds < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [Integer]
11
+ attr_accessor :all
12
+
13
+ # A mapping from model property names to API property names.
14
+ def self.names
15
+ @_hash = {} if @_hash.nil?
16
+ @_hash['all'] = 'all'
17
+ @_hash
18
+ end
19
+
20
+ def initialize(all = nil)
21
+ @all = all
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ all = hash['all']
30
+
31
+ # Create object from extracted values.
32
+ Clouds.new(all)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,44 @@
1
+ # weather_api_task
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WeatherApiTask
7
+ # Coord Model.
8
+ class Coord < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [Float]
11
+ attr_accessor :lat
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [Float]
15
+ attr_accessor :lon
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['lat'] = 'lat'
21
+ @_hash['lon'] = 'lon'
22
+ @_hash
23
+ end
24
+
25
+ def initialize(lat = nil,
26
+ lon = nil)
27
+ @lat = lat
28
+ @lon = lon
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
+ lat = hash['lat']
37
+ lon = hash['lon']
38
+
39
+ # Create object from extracted values.
40
+ Coord.new(lat,
41
+ lon)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,132 @@
1
+ # weather_api_task
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WeatherApiTask
7
+ # List Model.
8
+ class List < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [Integer]
11
+ attr_accessor :id
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :name
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [Coord]
19
+ attr_accessor :coord
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Main]
23
+ attr_accessor :main
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [Integer]
27
+ attr_accessor :dt
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [Wind]
31
+ attr_accessor :wind
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [Sys]
35
+ attr_accessor :sys
36
+
37
+ # TODO: Write general description for this method
38
+ # @return [Rain]
39
+ attr_accessor :rain
40
+
41
+ # TODO: Write general description for this method
42
+ # @return [String]
43
+ attr_accessor :snow
44
+
45
+ # TODO: Write general description for this method
46
+ # @return [Clouds]
47
+ attr_accessor :clouds
48
+
49
+ # TODO: Write general description for this method
50
+ # @return [List of Weather]
51
+ attr_accessor :weather
52
+
53
+ # A mapping from model property names to API property names.
54
+ def self.names
55
+ @_hash = {} if @_hash.nil?
56
+ @_hash['id'] = 'id'
57
+ @_hash['name'] = 'name'
58
+ @_hash['coord'] = 'coord'
59
+ @_hash['main'] = 'main'
60
+ @_hash['dt'] = 'dt'
61
+ @_hash['wind'] = 'wind'
62
+ @_hash['sys'] = 'sys'
63
+ @_hash['rain'] = 'rain'
64
+ @_hash['snow'] = 'snow'
65
+ @_hash['clouds'] = 'clouds'
66
+ @_hash['weather'] = 'weather'
67
+ @_hash
68
+ end
69
+
70
+ def initialize(id = nil,
71
+ name = nil,
72
+ coord = nil,
73
+ main = nil,
74
+ dt = nil,
75
+ wind = nil,
76
+ sys = nil,
77
+ clouds = nil,
78
+ weather = nil,
79
+ rain = nil,
80
+ snow = nil)
81
+ @id = id
82
+ @name = name
83
+ @coord = coord
84
+ @main = main
85
+ @dt = dt
86
+ @wind = wind
87
+ @sys = sys
88
+ @rain = rain
89
+ @snow = snow
90
+ @clouds = clouds
91
+ @weather = weather
92
+ end
93
+
94
+ # Creates an instance of the object from a hash.
95
+ def self.from_hash(hash)
96
+ return nil unless hash
97
+
98
+ # Extract variables from the hash.
99
+ id = hash['id']
100
+ name = hash['name']
101
+ coord = Coord.from_hash(hash['coord']) if hash['coord']
102
+ main = Main.from_hash(hash['main']) if hash['main']
103
+ dt = hash['dt']
104
+ wind = Wind.from_hash(hash['wind']) if hash['wind']
105
+ sys = Sys.from_hash(hash['sys']) if hash['sys']
106
+ clouds = Clouds.from_hash(hash['clouds']) if hash['clouds']
107
+ # Parameter is an array, so we need to iterate through it
108
+ weather = nil
109
+ unless hash['weather'].nil?
110
+ weather = []
111
+ hash['weather'].each do |structure|
112
+ weather << (Weather.from_hash(structure) if structure)
113
+ end
114
+ end
115
+ rain = Rain.from_hash(hash['rain']) if hash['rain']
116
+ snow = hash['snow']
117
+
118
+ # Create object from extracted values.
119
+ List.new(id,
120
+ name,
121
+ coord,
122
+ main,
123
+ dt,
124
+ wind,
125
+ sys,
126
+ clouds,
127
+ weather,
128
+ rain,
129
+ snow)
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,80 @@
1
+ # weather_api_task
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WeatherApiTask
7
+ # Main Model.
8
+ class Main < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [Float]
11
+ attr_accessor :temp
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [Float]
15
+ attr_accessor :feels_like
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [Float]
19
+ attr_accessor :temp_min
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Float]
23
+ attr_accessor :temp_max
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [Integer]
27
+ attr_accessor :pressure
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [Integer]
31
+ attr_accessor :humidity
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['temp'] = 'temp'
37
+ @_hash['feels_like'] = 'feels_like'
38
+ @_hash['temp_min'] = 'temp_min'
39
+ @_hash['temp_max'] = 'temp_max'
40
+ @_hash['pressure'] = 'pressure'
41
+ @_hash['humidity'] = 'humidity'
42
+ @_hash
43
+ end
44
+
45
+ def initialize(temp = nil,
46
+ feels_like = nil,
47
+ temp_min = nil,
48
+ temp_max = nil,
49
+ pressure = nil,
50
+ humidity = nil)
51
+ @temp = temp
52
+ @feels_like = feels_like
53
+ @temp_min = temp_min
54
+ @temp_max = temp_max
55
+ @pressure = pressure
56
+ @humidity = humidity
57
+ end
58
+
59
+ # Creates an instance of the object from a hash.
60
+ def self.from_hash(hash)
61
+ return nil unless hash
62
+
63
+ # Extract variables from the hash.
64
+ temp = hash['temp']
65
+ feels_like = hash['feels_like']
66
+ temp_min = hash['temp_min']
67
+ temp_max = hash['temp_max']
68
+ pressure = hash['pressure']
69
+ humidity = hash['humidity']
70
+
71
+ # Create object from extracted values.
72
+ Main.new(temp,
73
+ feels_like,
74
+ temp_min,
75
+ temp_max,
76
+ pressure,
77
+ humidity)
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,35 @@
1
+ # weather_api_task
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module WeatherApiTask
7
+ # Rain Model.
8
+ class Rain < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [Float]
11
+ attr_accessor :1h
12
+
13
+ # A mapping from model property names to API property names.
14
+ def self.names
15
+ @_hash = {} if @_hash.nil?
16
+ @_hash['1h'] = '1h'
17
+ @_hash
18
+ end
19
+
20
+ def initialize(1h = nil)
21
+ @1h = 1h
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ 1h = hash['1h']
30
+
31
+ # Create object from extracted values.
32
+ Rain.new(1h)
33
+ end
34
+ end
35
+ end