RAPP Platform API
 All Classes Namespaces Files Functions Variables Typedefs
CognitiveGetHistory.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 CognitiveGetHistory(CloudMsg):
12  """ Cognitive Get History Cloud Message object """
13 
14  class Request(CloudRequest):
15  """ Cognitive Get History Cloud Request object.
16 
17  CognitiveGetHistory.Request
18  """
19  def __init__(self, **kwargs):
20  """!
21  Constructor
22 
23  @param **kwargs - Keyword arguments. Apply values to the request attributes.
24  - @ref test_type
25  - @ref time_from
26  - @ref time_to
27  """
28 
29  ## Cognitive Exercise test type. Can be one of:
30  # - 'ArithmeticCts'
31  # - 'AwarenessCts'
32  # - 'ReasoningCts'
33  # - ''
34  #
35  # If left empty, history of all test types will be returned.
36  self.test_type = ''
37  ## Unix timestamp.
38  self.time_from = 0
39  ## Unix timestamp.
40  self.time_to = 0
41  super(CognitiveGetHistory.Request, self).__init__(**kwargs)
42 
43 
44  def make_payload(self):
45  """ Create and return the Payload of the Request. """
46  return Payload(
47  from_time=self.time_from,
48  to_time=self.time_to,
49  test_type=self.test_type)
50 
51 
52  def make_files(self):
53  """ Create and return Array of File objects of the Request. """
54  return []
55 
56 
57  class Response(CloudResponse):
58  """ Cognitive Get History Cloud Response object.
59 
60  CognitiveGetHistory.Response
61  """
62  def __init__(self, **kwargs):
63  """!
64  Constructor
65 
66  @param **kwargs - Keyword arguments. Apply values to the request attributes.
67  - @ref error
68  - @ref records
69  """
70 
71  ## Error message
72  self.error = ''
73  ## Users history records.
74  self.records = {}
75  super(CognitiveGetHistory.Response, self).__init__(**kwargs)
76 
77 
78  def __init__(self, **kwargs):
79  """!
80  Constructor
81 
82  @param **kwargs - Keyword argumen.ts. Apply values to the request attributes.
83  - @ref Request.test_type
84  - @ref Request.time_from
85  - @ref Request.time_to
86  """
87 
88  # Create and hold the Request object for this CloudMsg
90  # Create and hold the Response object for this CloudMsg
92  super(CognitiveGetHistory, self).__init__(
93  svcname='cognitive_get_history', **kwargs)
94 
95