RAPP Platform API
 All Classes Namespaces Files Functions Variables Typedefs
WeatherReportForecast.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 WeatherReportForecast(CloudMsg):
12  """ Weather Report Forecast Cloud Message object """
13 
14  class Request(CloudRequest):
15  """ Weather Report Forecast Cloud Request object.
16 
17  WeatherReportForecast.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(WeatherReportForecast.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 Forecast Cloud Response object.
54 
55  WeatherReportForecast.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 forecast
64  """
65 
66  ## Error message
67  self.error = ''
68  ## Array of forecastEntry objects, where forecastEntry is of structure:
69  # {high_temp: '', low_temp: '', description: '', date: ''}
70  self.forecast = []
71  super(WeatherReportForecast.Response, self).__init__(**kwargs)
72 
73 
74  def __init__(self, **kwargs):
75  """!
76  Constructor
77 
78  @param **kwargs - Keyword argumen.ts. Apply values to the request attributes.
79  - @ref Request.city
80  - @ref Request.weather_reporter
81  - @ref Request.metric
82  """
83 
84  # Create and hold the Request object for this CloudMsg
86  # Create and hold the Response object for this CloudMsg
88  super(WeatherReportForecast, self).__init__(
89  svcname='weather_report_forecast', **kwargs)
90 
91 
forecast
Array of forecastEntry objects, where forecastEntry is of structure: {high_temp: '', low_temp: '', description: '', date: ''}.