oeh-client 2.2.2 → 2.2.3

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.
@@ -0,0 +1,74 @@
1
+
2
+ class OEHClient::Realtime::Response
3
+
4
+ # HASH keys based on the response data
5
+ OPT_RESPONSE_CODE = "code"
6
+ OPT_RESPONSE_SENTIMENT = "sentiment"
7
+ OPT_RESPONSE_LABEL = "label"
8
+ OPT_RESPONSE_IMAGE_URL = "imageUrl"
9
+ OPT_RESPONSE_TARGET_URL = "targetUrl"
10
+ OPT_RESPONSE_TARGET = "target"
11
+
12
+ RESPONSE_CODE_PROPERTY = "_RESP_CODE_"
13
+
14
+ SENTIMENT_POSITIVE = "positive"
15
+ SENTIMENT_NEUTRAL = "neutral"
16
+ SENTIMENT_NEGATIVE = "negative"
17
+
18
+ # Localized attributes equivalent to the returned Hash object in the response
19
+ attr_accessor :code, # The response code needed for responses
20
+ :sentiment, # The sentiment of the response (POSITIVE, NEUTRAL, NEGATIVE)
21
+ :label, # The label used for display
22
+ :image_url, # The URL to the image
23
+ :target_url, # The url to redirect to when the response is selected
24
+ :target, # The Target Type (ONE, ...)
25
+ :optimization
26
+
27
+ # ---- Class Methods
28
+
29
+ def self.create(optimization, properties={})
30
+
31
+ # create a new instance of the OEHClient::Realtime::Optimization class
32
+ response_instance = OEHClient::Realtime::Response.new()
33
+
34
+ # assign all data attributes based on the properties object that is passed
35
+ response_instance.code = properties[OPT_RESPONSE_CODE] if (properties.has_key?(OPT_RESPONSE_CODE))
36
+ response_instance.sentiment = properties[OPT_RESPONSE_SENTIMENT] if (properties.has_key?(OPT_RESPONSE_SENTIMENT))
37
+ response_instance.label = properties[OPT_RESPONSE_LABEL] if (properties.has_key?(OPT_RESPONSE_LABEL))
38
+ response_instance.image_url = properties[OPT_RESPONSE_IMAGE_URL] if (properties.has_key?(OPT_RESPONSE_IMAGE_URL))
39
+ response_instance.target_url = properties[OPT_RESPONSE_TARGET_URL] if (properties.has_key?(OPT_RESPONSE_TARGET_URL))
40
+ response_instance.target = properties[OPT_RESPONSE_TARGET] if (properties.has_key?(OPT_RESPONSE_TARGET))
41
+ # map the parent object
42
+ response_instance.optimization = optimization
43
+ #return the new instance of the optimization class
44
+ response_instance
45
+
46
+ end
47
+
48
+ # ---- Instance Methods
49
+
50
+ # helper method to get the interacton object from the parent optimization
51
+ def interaction
52
+ @optimization.interaction
53
+ end
54
+
55
+ # wrapper for sending the response from the existing object
56
+ def send
57
+ interaction.send_update({RESPONSE_CODE_PROPERTY => @code})
58
+ end
59
+
60
+ # returns true if the curent response is a positive response
61
+ def is_positive?()
62
+ (@sentiment.casecmp(SENTIMENT_POSITIVE) == 0)
63
+ end
64
+ # returns true if the current response is a neutral response
65
+ def is_neutral?()
66
+ ( @sentiment.casecmp(SENTIMENT_NEUTRAL) == 0)
67
+ end
68
+ # returns true if the current response is a negative response
69
+ def is_negative?
70
+ ( @sentiment.casecmp(SENTIMENT_NEGATIVE) == 0)
71
+ end
72
+
73
+
74
+ end
@@ -0,0 +1,11 @@
1
+ module OEHClient
2
+
3
+ module Realtime
4
+ end
5
+
6
+ end
7
+
8
+ require File.dirname(__FILE__) + '/realtime/interaction'
9
+ require File.dirname(__FILE__) + '/realtime/event'
10
+ require File.dirname(__FILE__) + '/realtime/optimization'
11
+ require File.dirname(__FILE__) + '/realtime/response'
@@ -0,0 +1,3 @@
1
+ module OEHClient
2
+ VERSION = "2.2.3"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oeh-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Balliet
@@ -179,6 +179,27 @@ files:
179
179
  - lib/oeh-client.rb
180
180
  - lib/oeh_client.rb
181
181
  - lib/oehclient.rb
182
+ - lib/oehclient/config.rb
183
+ - lib/oehclient/config/space.rb
184
+ - lib/oehclient/config/space_manager.rb
185
+ - lib/oehclient/data.rb
186
+ - lib/oehclient/data/node.rb
187
+ - lib/oehclient/data/structure.rb
188
+ - lib/oehclient/exception.rb
189
+ - lib/oehclient/helper.rb
190
+ - lib/oehclient/meta.rb
191
+ - lib/oehclient/meta/entity.rb
192
+ - lib/oehclient/meta/interaction.rb
193
+ - lib/oehclient/meta/session.rb
194
+ - lib/oehclient/meta/touchpoint.rb
195
+ - lib/oehclient/meta/workspace.rb
196
+ - lib/oehclient/meta/workspace_entity.rb
197
+ - lib/oehclient/realtime.rb
198
+ - lib/oehclient/realtime/event.rb
199
+ - lib/oehclient/realtime/interaction.rb
200
+ - lib/oehclient/realtime/optimization.rb
201
+ - lib/oehclient/realtime/response.rb
202
+ - lib/oehclient/version.rb
182
203
  homepage: https://rubygems.org/gems/oeh-client
183
204
  licenses:
184
205
  - MIT