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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06e39f3001a36c1994e02be62d2eb89523dbd03f
4
- data.tar.gz: 6e3b581b5928a4d110eb75bb3d7c5379ef61d836
3
+ metadata.gz: 7b7c11334e6329e4cb2e3742c5dfc026e85eb63b
4
+ data.tar.gz: ec01649af390e9f5663fea23afbc2113a04505bc
5
5
  SHA512:
6
- metadata.gz: d2f35633fc7ea252dea8e75a9f82cc90bf8c1317dcf722c9befc299826379d0c243c28ffb36f2e48b6f4973d5433070f1188a36131dfdb76894d4934c0e65ecb
7
- data.tar.gz: 6ed445491c403421b489bf2e95474641f5172ddbcd83638716cdc6a8e76b02fe100ed024a8fd1dba1a2b74b89cfd955a6ae1c4bc0e95918b7d9e180801fcf8f6
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
- TODO: Write usage instructions here
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
- ## Development
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
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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
 
@@ -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
- # add_attribute dynamically creates an attr_accessor for the passed key_value pair either
35
- # as a simple value attribute or as an instance of another Node class
36
- def add_attribute(name, value)
37
-
38
- # generate a ruby-friendly attribute accessor based on the name of the
39
- # structure attribute
40
- accessor_name = name.underscore
41
- accessor_name.gsub!(/( )/, '_') if (accessor_name.match(/\s/))
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
@@ -69,9 +69,14 @@ class OEHClient::Meta::Workspace
69
69
  workspace_instance
70
70
  end # def self.fetch
71
71
 
72
+
72
73
  ###
73
74
  ### ------------- Instance Methods
74
75
  ###
75
76
 
77
+ def touchpoints()
78
+
79
+ end
80
+
76
81
 
77
82
  end
@@ -1,3 +1,3 @@
1
1
  module OEHClient
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
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.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-01 00:00:00.000000000 Z
11
+ date: 2015-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler