RAPP Platform API
 All Classes Namespaces Files Functions Variables Typedefs
WeatherReportCurrent.py
Go to the documentation of this file.
1 from RappCloud.Objects import (
2  File,
3  Payload)
4 
5 from Cloud import (
6  CloudMsg,
7  CloudRequest,
8  CloudResponse)
9 
10 
11 class WeatherReportCurrent(CloudMsg):
12  """ Weather Report Current Cloud Message object """
13 
14  class Request(CloudRequest):
15  """ Weather Report Current Cloud Request object.
16 
17  WeatherReportCurrent.Request
18  """
19  def __init__(self, **kwargs):
20  """!
21  Constructor
22 
23  @param **kwargs - Keyword arguments. Apply values to the request attributes.
24  - @ref city
25  - @ref weather_reporter
26  - @ref metric
27  """
28 
29  ## The desired city
30  self.city = ''
31  ## The weather API to use. Defaults to "yweather" .
32  self.weather_reporter = ''
33  ## The return value units.
34  self.metric = 0
35  super(WeatherReportCurrent.Request, self).__init__(**kwargs)
36 
37 
38  def make_payload(self):
39  """ Create and return the Payload of the Request. """
40  return Payload(
41  city=self.city,
42  weather_reporter=self.weather_reporter,
43  metric=self.metric
44  )
45 
46 
47  def make_files(self):
48  """ Create and return Array of File objects of the Request. """
49  return []
50 
51 
52  class Response(CloudResponse):
53  """ Weather Report Current Cloud Response object.
54 
55  WeatherReportCurrent.Response
56  """
57  def __init__(self, **kwargs):
58  """!
59  Constructor
60 
61  @param **kwargs - Keyword arguments. Apply values to the request attributes.
62  - @ref error
63  - @ref date
64  - @ref temperature
65  - @ref weather_description
66  - @ref humidity
67  - @ref visibility
68  - @ref pressure
69  - @ref wind_speed
70  - @ref wind_temperature
71  - @ref wind_direction
72  """
73 
74  ## Error message
75  self.error = ''
76  ## Current date
77  self.date = ''
78  ## Current temperature
79  self.temperature = ''
80  ## A brief description of the current weather
82  ## Current humidity
83  self.humidity = ''
84  ## Current vilibility
85  self.visibility = ''
86  ## Current pressure
87  self.pressure = ''
88  ## Current speed of the wind
89  self.wind_speed = ''
90  ## Current temperature of the wind
91  self.wind_temperature = ''
92  ## Current wind direction
93  self.wind_direction = ''
94  super(WeatherReportCurrent.Response, self).__init__(**kwargs)
95 
96 
97  def __init__(self, **kwargs):
98  """!
99  Constructor
100 
101  @param **kwargs - Keyword argumen.ts. Apply values to the request attributes.
102  - @ref Request.city
103  - @ref Request.weather_reporter
104  - @ref Request.metric
105  """
106 
107  # Create and hold the Request object for this CloudMsg
109  # Create and hold the Response object for this CloudMsg
111  super(WeatherReportCurrent, self).__init__(
112  svcname='weather_report_current', **kwargs)
113 
114