cobot_client 0.1.0 → 0.2.0

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.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # CobotClient
2
2
 
3
+ [![Build Status](https://travis-ci.org/cobot/cobot_client.png?branch=master)](https://travis-ci.org/cobot/cobot_client)
4
+
3
5
  A client for the [Cobot](http://cobot.me) [API](http://cobot.me/pages/api) plus helpers.
4
6
 
5
7
  ## Installation
@@ -22,7 +24,8 @@ Or install it yourself as:
22
24
 
23
25
  You can install links to your app into the navigation on Cobot. When users click the link an iframe pointing to the given `iframe_url` will be shown.
24
26
 
25
- CobotClient::NavigationLinkService.new().install_links [
27
+ client = OAuth2::Client.new <...>
28
+ CobotClient::NavigationLinkService.new(client, '<access token>', 'co-up').install_links [
26
29
  CobotClient::NavigationLink.new(section: 'admin/manage', label: 'My App', iframe_url: 'http://example.com')]
27
30
 
28
31
  ### Setting up automatic iframe resizing
@@ -45,6 +48,8 @@ Add the following code to your application controller:
45
48
 
46
49
  include CobotClient::XdmHelper
47
50
 
51
+ This will automatically resize Cobot's iframe whenever a new page is loaded. To manually trigger a resize call `window.Cobot.iframeResize()`.
52
+
48
53
  ### Generating URLs to the Cobot API
49
54
 
50
55
  There is a module `CobotClient::UrlHelper`. After you include it you can call `cobot_url`. Examples:
@@ -1,12 +1,16 @@
1
1
  <script>
2
- $(function() {
3
- easyXDM.query = <%== xdm_params.to_json %>;
4
- window.socket = new easyXDM.Socket({
5
- onReady: function() {
6
- setTimeout(function() {
7
- window.socket.postMessage($('body').outerHeight());
8
- }, 100);
9
- }
10
- });
2
+ window.Cobot = window.Cobot || {};
3
+ window.Cobot.iframeResize = function() {
4
+ if(window.socket) {
5
+ window.socket.postMessage($('body').outerHeight());
6
+ }
7
+ }
8
+ easyXDM.query = <%== xdm_params.to_json %>;
9
+ window.socket = new easyXDM.Socket({
10
+ onReady: function() {
11
+ setTimeout(function() {
12
+ window.Cobot.iframeResize();
13
+ }, 100);
14
+ }
11
15
  });
12
16
  </script>
@@ -1,3 +1,3 @@
1
1
  module CobotClient
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cobot_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-21 00:00:00.000000000 Z
12
+ date: 2013-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport