oeh-client 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f692b3e09448980d130c5b6f9b031c4238211fe
4
- data.tar.gz: 085a267a6504f505244e725b9081f49976f6fe35
3
+ metadata.gz: d9f5960ced53f58584b1935cfe270272eb42316a
4
+ data.tar.gz: c387e88e484567f322b38f0000e4a2b3771af84f
5
5
  SHA512:
6
- metadata.gz: 92571201066617e1bc99fed7bdd627b708a91b6253d82eefc90eb399db8527aab8b7dcc4f5ccceaa24805fc6d0a075e850a0d1e7767346a3ac31483ee14c19e8
7
- data.tar.gz: 3b02be0c9729a14531c489b267552ebe8f816ba66707b7c540524d918007905ae52ebf4880413c69a0a3f332c74c22af1bad412ed94ac5262364c5932711a018
6
+ metadata.gz: f3a11dd8fbdaa7e532b982b846f59733d781a77fcb575ee0e964eda2c48035c98222c60b6e071d768e50ce9de34ae387327dbb54ea2218286644fdecf0641392
7
+ data.tar.gz: e811cc449587f719b12c374f42b79e8b055b5394b1c535a1f289805dae9226e25005e9c19c48e5eba78e8b358740ef309f10cc66951b202a8ab88ca46b096514
data/README.md CHANGED
@@ -1,8 +1,18 @@
1
1
  # OEHClient
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/oehclient`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ ONE Engagement Hub (OEH) is the premier customer engagement platform offered by Thunderhead, Inc. The OEHClient ('oeh-client') gem is a series of wrapper classes that allow your ruby/rails applicaitons to easily support integration with the platform.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ## Feature Description
6
+
7
+ OEHClient exposes the key features of the ONE Engagement Hub (OEH) system through some simplified classes. The client interface allows you to:
8
+
9
+ * Register multiple spaces (OEH Configurations) to allow a single application to interact with each of your company configurations
10
+
11
+ * Post customer and anoymous interactions to the ONE Engagement Hub (OEH) server
12
+
13
+ * Manage and expose personalized assets and response handlers for optimized interactions
14
+
15
+ * Fetch structure data from the ONE Engagement Hub (OEH) in realtime
6
16
 
7
17
  ## Installation
8
18
 
@@ -14,7 +24,7 @@ gem 'oeh-client'
14
24
 
15
25
  And then execute:
16
26
 
17
- $ bundle
27
+ $ bundle install
18
28
 
19
29
  Or install it yourself as:
20
30
 
@@ -4,8 +4,8 @@ class OEHClient::Config::Space
4
4
  :host, # The name of the HOST machine on thunderhead.com (ONEDEMO, EU2, NA4, etc..)
5
5
  :api_key, # The API key provided in the ONE SETTINGS interface
6
6
  :shared_secret, # The shared secret value provided in the ONE SETTINGS interface
7
- :username # The fully-qualified username configured for access to the space
8
-
7
+ :username, # The fully-qualified username configured for access to the space
8
+ :meta_password # The password needed to access meta-data from the OEH server
9
9
 
10
10
  # ---- Class Methods
11
11
 
@@ -22,6 +22,7 @@ class OEHClient::Config::Space
22
22
  space_instance.api_key = properties[:api_key] if (properties.has_key?(:api_key))
23
23
  space_instance.shared_secret = properties[:shared_secret] if (properties.has_key?(:shared_secret))
24
24
  space_instance.username = properties[:username] if (properties.has_key?(:username))
25
+ space_instance.meta_password = properties[:meta_password] if (properties.has_key?(:meta_password))
25
26
 
26
27
  # return the instance of the OEHClient::Site Class
27
28
  space_instance
@@ -56,4 +57,11 @@ class OEHClient::Config::Space
56
57
  (!@username.nil? && !@username.empty?))
57
58
  end
58
59
 
60
+ # determines if the space configuration appears to be valid for access to the raw meta-data entities.
61
+ # The method expects the standard valid attributes from is_valid? as well as the meta_password
62
+ # attribute
63
+ def meta_access?()
64
+ self.is_valid? && (!@meta_password.blank?)
65
+ end
66
+
59
67
  end
@@ -44,7 +44,6 @@ module OEHClient
44
44
  module Response
45
45
 
46
46
  def self.handle(api_response)
47
-
48
47
  # raise a generic HTTPRequestException if the the status code is not 100 (Continue) or 200 (OK)
49
48
  raise OEHClient::Exception::HTTPRequestException.new(api_response.message, api_response.code) if (api_response.code != "200" && api_response.code != "100")
50
49
 
@@ -22,7 +22,7 @@ class OEHClient::Interaction::Interaction
22
22
 
23
23
 
24
24
  attr_accessor :uri, # The full touchpoint/interaction URI used to post the interaction
25
- :space, # The configured OEHClient::Config::Space object that represents the
25
+ :space, # The configured OEHClient::Config::Space object that represents the OEH workspace
26
26
 
27
27
  :timestamp, # A millisecond value representing a Time value of the interaction
28
28
  :customer_key, # The customer to which this interaction is related
@@ -51,7 +51,7 @@ class OEHClient::Interaction::Interaction
51
51
  }
52
52
 
53
53
  # conditionally merge the rest of the attributes if they are passed
54
- attributes.merge!(:timestamp => timestamp) if (!timestamp.nil? && !timestamp.empty?)
54
+ attributes.merge!(:timestamp => timestamp) unless (timestamp.nil?)
55
55
  attributes.merge!(:tid => tid) if (!tid.nil? && !tid.empty?)
56
56
  attributes.merge!(:ck => customer_key) if (!customer_key.nil? && !customer_key.empty?)
57
57
 
@@ -111,18 +111,21 @@ class OEHClient::Interaction::Interaction
111
111
  # send() will post a new interaction using either the realtime (current timestamp) or the offline (historic)
112
112
  # API interface based on the existence of a timestamp value
113
113
  def send(parameters={})
114
+ # raise the MissingParameterException when one (or more) of the miminal parameters are missing
115
+ raise OEHClient::Exception::MissingParameterException.new(missing_minimal_parameters) unless (minimal_parameters?)
114
116
 
115
117
  # call the appropriate method based on the existance of the timestamp value
116
- ((minimal_parameters? && !@timestamp.nil? && @timestamp > 0) ? send_offline(@space.token) : send_realtime(@space.token, parameters))
118
+ ((!@timestamp.nil? && @timestamp > 0) ? send_offline(@space.token) : send_realtime(@space.token, parameters))
117
119
 
118
120
  # return the current instance interacton
119
121
  self
120
-
121
122
  end
122
123
 
123
124
  # send_new posts a new interaction using the existing instance data, but for a different touchpoint
124
125
  # URI. The method returns a new instance of the OEHClient::Interaction::Interaction class
125
126
  def send_new(uri, timestamp=nil, parameters={})
127
+ # raise the MissingParameterException when one (or more) of the miminal parameters are missing
128
+ raise OEHClient::Exception::MissingParameterException.new(missing_minimal_parameters) unless (minimal_parameters?)
126
129
 
127
130
  # protect against NIL by creating a new Hash object if the parameters, for any reason is
128
131
  # NIL
@@ -142,12 +145,13 @@ class OEHClient::Interaction::Interaction
142
145
 
143
146
  # Send the interaction for processing and return the current instance
144
147
  new_interaction.send(parameters)
145
-
146
148
  end
147
149
 
148
150
  # send_update allows the system to update the capture and tracking properties that are defined as
149
151
  # part of the existing interaction
150
152
  def send_update(properties={})
153
+ # raise the MissingParameterException when one (or more) of the miminal parameters are missing
154
+ raise OEHClient::Exception::MissingParameterException.new(missing_minimal_parameters) unless (minimal_parameters?)
151
155
 
152
156
  # force the properties object to be an empty Hash if, for any reason, it is NIL
153
157
  properties ||= Hash.new
@@ -159,7 +163,6 @@ class OEHClient::Interaction::Interaction
159
163
  request_data(properties))) unless properties.empty?
160
164
  # return the current object
161
165
  self
162
-
163
166
  end
164
167
 
165
168
 
@@ -228,7 +231,20 @@ class OEHClient::Interaction::Interaction
228
231
  # present in the current instance of the interaction class. This is a helper method that is used
229
232
  # before making any request
230
233
  def minimal_parameters?()
231
- !@uri.nil? && !@site_key.nil?
234
+ ((!@uri.nil? && !@uri.empty?) && !@space.nil?)
235
+ end
236
+
237
+ # missing_minimal_parameters returns an array of the minimal attributes that are missing from the current
238
+ # instance of OEHClient::Interaction::Interaction class
239
+ def missing_minimal_parameters
240
+
241
+ missing_parameters = []
242
+
243
+ missing_parameters << "site_key" if (!minimal_parameters? && @site_key.nil?)
244
+ missing_parameters << "uri" if (!minimal_parameters? && @uri.nil?)
245
+
246
+ missing_parameters
247
+
232
248
  end
233
249
 
234
250
  # request_url returns the base of the request URL used to make either a realtime or offline request
@@ -32,6 +32,8 @@ class OEHClient::Interaction::Optimization
32
32
  optimization_instance.mime_type = properties[OPT_RESPONSE_MIME_TYPE] if (properties.has_key?(OPT_RESPONSE_ID))
33
33
  optimization_instance.directives = properties[OPT_RESPONSE_DIRECTIVES] if (properties.has_key?(OPT_RESPONSE_DIRECTIVES))
34
34
 
35
+ #puts "Response ID is #{Base64.decode64(optimization_instance.response_id)}"
36
+
35
37
  #return the new instance of the optimzation class
36
38
  optimization_instance
37
39
 
@@ -43,7 +45,6 @@ class OEHClient::Interaction::Optimization
43
45
  # decodes the Base64 encoded data and returns it raw form
44
46
  def decode_data()
45
47
 
46
-
47
48
  CGI.unescapeHTML(Base64.decode64(@data.to_json))
48
49
 
49
50
  end
@@ -1,3 +1,3 @@
1
1
  module OEHClient
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/oeh-client-0.1.0.gem CHANGED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oeh-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Balliet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-06 00:00:00.000000000 Z
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler