jive-tile 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c76114bed4cd8a488494306e87d3cddd3a7fa13e
4
- data.tar.gz: 94722ef33dd1b1b85cd2ce67adaaddea2e651d5f
3
+ metadata.gz: 1cdb4849328f76b637ca7f261d0fe0ad5e8f1457
4
+ data.tar.gz: 4c9fbc5ba1a645146d7ddf89c5291c40c064fd92
5
5
  SHA512:
6
- metadata.gz: 3f78a0628b42e53c0d36ccedb455f6af475d72c390a8ff183c265d0bfe1f3ecb20ec2253fe6f01da6bcb6031708ba0d4da1ed0bdcac4ad2c979fa007553eade4
7
- data.tar.gz: 20a7f8f2ddd5475e6ddc005345653b7b716d7fa4ecf84e7e98aa2ddac94aaf792a5d9958de99b278461a825e0d7acf27256acee3c6dd7660615d5aa37f876da8
6
+ metadata.gz: 88e062d55550b42255f2e7b92d5bce2627ca37107dcf96bca1ac7319d2b92d756825644996c11de3943018329d43da184c9320c9004911f2c06aff921807215b
7
+ data.tar.gz: 0d9fb1d69da46e5026b043c11dc04d7f7922ab0e3811463c5baf1415ae96485ee278a34b7fe90500cc30c3ef8953bb457633cf8ca441203ba7451a91ae762adf
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in jive-tile.gemspec
4
4
  gemspec
5
+
6
+ gem "jive-oauth_token", :path => "../ruby-jive-oauth_token"
data/jive-tile.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  # Tiles require association with an AddOn
24
24
  spec.add_dependency "jive-add_on"
25
+ spec.add_dependency "jive-oauth_token"
25
26
 
26
27
  if RUBY_PLATFORM == 'java'
27
28
  spec.add_development_dependency "jdbc-sqlite3", "> 0"
@@ -3,7 +3,7 @@ module Jive
3
3
  class Model < ActiveRecord::Base
4
4
  self.table_name = :jive_tiles
5
5
  belongs_to :add_on, :class_name => "Jive::AddOn::Model", :foreign_key => :jive_add_on_id
6
- belongs_to :oauth_token, :class_name => "Jive::Tile::OAuthToken", :foreign_key => :jive_tiles_oauth_token_id
6
+ has_one :oauth_token, :class_name => "Jive::OauthToken::Model", :as => :owner
7
7
  serialize :config, Hash
8
8
 
9
9
  after_create :fetch_oauth_token
@@ -14,6 +14,8 @@ module Jive
14
14
  require "net/http"
15
15
  require "openssl"
16
16
 
17
+ return if self.add_on.nil?
18
+
17
19
  uri = URI.parse("#{self.add_on.jive_url}/oauth2/token")
18
20
  http = Net::HTTP.new(uri.host, uri.port)
19
21
  http.use_ssl = true
@@ -35,8 +37,8 @@ module Jive
35
37
  json_body = JSON.parse(response.body)
36
38
 
37
39
  # Create
38
- Jive::Tile::OauthToken.create(
39
- :tile => self,
40
+ Jive::OauthToken::Model.create(
41
+ :owner => self,
40
42
  :scope => json_body["scope"],
41
43
  :token_type => json_body["token_type"],
42
44
  :expires_in => json_body["expires_in"],
@@ -1,5 +1,5 @@
1
1
  module Jive
2
2
  module Tile
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
data/lib/jive/tile.rb CHANGED
@@ -2,14 +2,13 @@ require "active_support"
2
2
  require "active_support/dependencies"
3
3
  require "active_record"
4
4
 
5
+ require "jive/oauth_token"
5
6
  require "jive/add_on"
6
7
  require "jive/tile/add_on/class_methods"
7
8
 
8
9
  require "jive/tile/version"
9
10
  require "jive/tile/compatibility"
10
11
  require "jive/tile/model"
11
- require "jive/tile/oauth_token"
12
-
13
12
 
14
13
  module Jive
15
14
  module Tile
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jive-tile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Butch Marshall
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: jive-oauth_token
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: sqlite3
49
63
  requirement: !ruby/object:Gem::Requirement
@@ -168,7 +182,6 @@ files:
168
182
  - lib/jive/tile/add_on/class_methods.rb
169
183
  - lib/jive/tile/compatibility.rb
170
184
  - lib/jive/tile/model.rb
171
- - lib/jive/tile/oauth_token.rb
172
185
  - lib/jive/tile/version.rb
173
186
  homepage: https://github.com/butchmarshall/ruby-jive-tile
174
187
  licenses:
@@ -1,8 +0,0 @@
1
- module Jive
2
- module Tile
3
- class OauthToken < ActiveRecord::Base
4
- self.table_name = :jive_tiles_oauth_tokens
5
- has_one :tile, :class_name => "Jive::Tile::Model", :foreign_key => :jive_tiles_oauth_token_id
6
- end
7
- end
8
- end