oeh-client 0.2.2 → 0.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.
- checksums.yaml +4 -4
- data/README.md +26 -4
- data/lib/oehclient/helper.rb +2 -2
- data/lib/oehclient/meta/entity.rb +33 -12
- data/lib/oehclient/meta/workspace.rb +5 -0
- data/lib/oehclient/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b7c11334e6329e4cb2e3742c5dfc026e85eb63b
|
4
|
+
data.tar.gz: ec01649af390e9f5663fea23afbc2113a04505bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa9b2d77a89babbb98587024d1d15c8491ff6d548f6f580249d6e42f5310111f065d1a4715264be2db0229acff2debd3d975bcba239925d04b571d7d766f4830
|
7
|
+
data.tar.gz: 811069af84a9d4968852a607bbb136876876d55d7428895ff0e572364999e41ba4e5d705334bc96c593e3d679ca83b9c681f23f44816f65fff478063867d2196
|
data/README.md
CHANGED
@@ -32,13 +32,35 @@ Or install it yourself as:
|
|
32
32
|
|
33
33
|
## Usage
|
34
34
|
|
35
|
-
|
35
|
+
Each OEH instance can contain one ore more 'spaces', which contain separate application configurations. Each space is provided a unique key that identifies it within the existing SaaS environment. To access the space, you first need to register the space details with the space manager singleton as follows:
|
36
36
|
|
37
|
-
|
37
|
+
```ruby
|
38
|
+
|
39
|
+
space_parameters = {
|
40
|
+
:site_key => "YOUR_SITE_KEY",
|
41
|
+
:host => "YOUR_THINSTANCE_SERVER_NAME"
|
42
|
+
:api_key => "YOUR_API_KEY",
|
43
|
+
:shared_secret => "YOUR_SHARED_SECRET_KEY",
|
44
|
+
:username => "CONFIGURED_USERNAME",
|
45
|
+
:meta_password => "LOGIN_PASSWORD_FOR_USERNAME"
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
OEHClient::Config::SpaceManager.instance.register_space(space_parameters)
|
50
|
+
|
51
|
+
```
|
38
52
|
|
39
|
-
|
53
|
+
As needed, you can register multiple spaces for the same instances to support integration with a number of spaces within your application.
|
54
|
+
|
55
|
+
### Interactions
|
56
|
+
|
57
|
+
Interactions are the key elements of the customer experience. Interactions represent the back-and-forth between the customer and your organization. You can post an interaction simply:
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
customer_interaction = OEHClient::Interaction::Interaction.post("YOUR_TARGET_SITE_KEY", "TOUCHPOINT_INTERACTION_URI")
|
61
|
+
```
|
62
|
+
The post method will return an instance of the OE
|
40
63
|
|
41
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
42
64
|
|
43
65
|
## Contributing
|
44
66
|
|
data/lib/oehclient/helper.rb
CHANGED
@@ -60,13 +60,13 @@ module OEHClient
|
|
60
60
|
|
61
61
|
def self.handle(rest_response)
|
62
62
|
|
63
|
-
valid_response_codes = [100, 200, 302]
|
63
|
+
valid_response_codes = [100, 200, 204, 302]
|
64
64
|
# raise a generic HTTPRequestException if the the status code is not 100 (Continue) or 200 (OK)
|
65
65
|
raise OEHClient::Exception::HTTPRequestException.new("HTTP Request Exception with code #{rest_response.code}", rest_response.code) unless (valid_response_codes.include?(rest_response.code))
|
66
66
|
|
67
67
|
api_response = Hash.new
|
68
68
|
|
69
|
-
api_response[:body] = (OEHClient::Helper::Response.valid_json?(rest_response.body) ? ActiveSupport::JSON.decode(rest_response.body) : rest_response.body)
|
69
|
+
api_response[:body] = (rest_response.code == 204 ? {} : (OEHClient::Helper::Response.valid_json?(rest_response.body) ? ActiveSupport::JSON.decode(rest_response.body) : rest_response.body))
|
70
70
|
api_response[:cookies] = rest_response.cookies
|
71
71
|
|
72
72
|
api_response
|
@@ -17,6 +17,19 @@ class OEHClient::Meta::Entity
|
|
17
17
|
def self.create()
|
18
18
|
end # def self.create
|
19
19
|
|
20
|
+
def self.find(*args)
|
21
|
+
|
22
|
+
options = args.extract_options!
|
23
|
+
|
24
|
+
case args.first
|
25
|
+
when :first then find_initial(options)
|
26
|
+
when :last then find_last(options)
|
27
|
+
when :all then find_every(options)
|
28
|
+
else find_from_id(args, options)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
20
33
|
def self.fetch(space, entity_type)
|
21
34
|
|
22
35
|
url = "#{OEHClient::Helper::Request::ONE_PROTOCOL}#{space.host}#{OEHClient::Helper::Request::THUNDERHEAD_DOMAIN}/one/services/api/#{entity_type.downcase.pluralize}"
|
@@ -31,19 +44,27 @@ class OEHClient::Meta::Entity
|
|
31
44
|
### ------------- Instance Methods
|
32
45
|
###
|
33
46
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
# create the accessor in the current class and set the value based on the type
|
43
|
-
# of object that represents the value
|
44
|
-
self.class.send(:attr_accessor, accessor_name)
|
45
|
-
instance_variable_set("@#{accessor_name}", (value.kind_of?(Hash) ? OEHClient::Data::Node.new(value) : value))
|
47
|
+
###
|
48
|
+
### ------------- Protected Class Methods
|
49
|
+
###
|
50
|
+
|
51
|
+
protected
|
52
|
+
|
53
|
+
|
54
|
+
def self.find_initial(options)
|
46
55
|
|
47
56
|
end
|
48
57
|
|
58
|
+
def self.find_last(options)
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def self_find_every(options)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.find_from_id(args, options)
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
|
49
70
|
end
|
data/lib/oehclient/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.3
|
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-12-
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|