jive-tile 0.0.7 → 0.0.8

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: 0530c49f3d8a99281b23f5121c0080e179dd2d47
4
- data.tar.gz: 8b62f6260ae0cd1dc662760ee70585e363c78429
3
+ metadata.gz: a8209f623b40e109f3874a53e58a503442e2685d
4
+ data.tar.gz: 435667c040a6b8d447a7da9a790ce79cc8071e2b
5
5
  SHA512:
6
- metadata.gz: 5939b964b337e7a0f04a5d54404be2c49a0a7cd621aa888fe412ab158ba444f4cc6b16ed1369496559317e9a4210e8e71a7f4f1f75c96e922a3d92ac40872751
7
- data.tar.gz: 5abfec8d65450a2d209b605f0861fdeb4cd22a299a4b29758b1457893f475b5f94481d12aafc1ea1e986dfa4e4223af41ba82030337e8e76de3cc01474b13697
6
+ metadata.gz: a4151cc1c0fbfac04cd24faaf782b3a1d851b053ac37a7a466791f6d51fbb3c1d776ed5193a98805fda0f5b424f5b5062c803b0721a648fae40df2de4ceac4c3
7
+ data.tar.gz: 07c994110178561a815eba80fe4d6e8ab66fb57e30496d5231db8bb1782beb0d2807026739828efbe5794ad91cca2b351efc11f9e9dbe68efc954f5122e4214e
data/README.md CHANGED
@@ -33,7 +33,7 @@ rails generate jive:tile:active_record
33
33
  To the ActiveRecord model:
34
34
 
35
35
  ```ruby
36
- Jive::Tile::Model.new(...)
36
+ Jive::Tile.new(...)
37
37
  ```
38
38
 
39
39
  ## Contributing
data/jive-tile.gemspec CHANGED
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "activerecord", [">= 3.0", "< 5.0"]
22
22
 
23
23
  # Tiles require association with an AddOn
24
- spec.add_dependency "jive-add_on"
25
- spec.add_dependency "jive-oauth_token"
24
+ spec.add_dependency "jive-add_on", ">= 0.0.2"
25
+ spec.add_dependency "jive-oauth_token", ">= 0.0.3"
26
26
 
27
27
  if RUBY_PLATFORM == 'java'
28
28
  spec.add_development_dependency "jdbc-sqlite3", "> 0"
@@ -5,7 +5,7 @@ require "rails/generators/active_record"
5
5
 
6
6
  # Extend the HasDynamicColumnsGenerator so that it creates an AR migration
7
7
  module Jive
8
- module Tile
8
+ class Tile < ActiveRecord::Base
9
9
  class ActiveRecordGenerator < ::Jive::Tile::Generator
10
10
  include Rails::Generators::Migration
11
11
  extend NextMigrationVersion
@@ -1,5 +1,5 @@
1
1
  module Jive
2
- module Tile
2
+ class Tile < ActiveRecord::Base
3
3
  module NextMigrationVersion
4
4
  # while methods have moved around this has been the implementation
5
5
  # since ActiveRecord 3.0
@@ -2,7 +2,7 @@ require 'rails/generators/base'
2
2
  require 'jive/tile/compatibility'
3
3
 
4
4
  module Jive
5
- module Tile
5
+ class Tile < ActiveRecord::Base
6
6
  class Generator < Rails::Generators::Base
7
7
  source_paths << File.join(File.dirname(__FILE__), 'templates')
8
8
  end
data/lib/jive/tile.rb CHANGED
@@ -8,12 +8,16 @@ require "jive/tile/add_on/class_methods"
8
8
 
9
9
  require "jive/tile/version"
10
10
  require "jive/tile/compatibility"
11
- require "jive/tile/model"
11
+ require "jive/tile/class_methods"
12
+ require "jive/tile/instance_methods"
12
13
 
13
14
  module Jive
14
- module Tile
15
+ class Tile < ActiveRecord::Base
15
16
  end
16
17
  end
17
18
 
19
+ Jive::Tile.send :include, Jive::Tile::InstanceMethods
20
+ Jive::Tile.send :extend, Jive::Tile::ClassMethods
21
+
18
22
  # We want add-ons to know they can now associate with Tiles
19
- Jive::AddOn::Model.send :include, Jive::Tile::AddOn::Model::ClassMethods
23
+ Jive::AddOn.send :include, Jive::Tile::AddOn::ClassMethods
@@ -1,12 +1,10 @@
1
1
  module Jive
2
- module Tile
2
+ class Tile < ActiveRecord::Base
3
3
  module AddOn
4
- module Model
5
- module ClassMethods
6
- def self.included(base)
7
- base.class_eval do
8
- has_many :tiles, :class_name => "Jive::Tile::Model", :foreign_key => :jive_add_on_id
9
- end
4
+ module ClassMethods
5
+ def self.included(base)
6
+ base.class_eval do
7
+ has_many :tiles, :class_name => "Jive::Tile", :foreign_key => :jive_add_on_id
10
8
  end
11
9
  end
12
10
  end
@@ -0,0 +1,13 @@
1
+ module Jive
2
+ class Tile < ActiveRecord::Base
3
+ module ClassMethods
4
+ def self.extended(base)
5
+ base.belongs_to :add_on, :class_name => "Jive::AddOn", :foreign_key => :jive_add_on_id
6
+ base.validates :jive_add_on_id, :presence => true
7
+ base.has_one :oauth_token, :class_name => "Jive::OauthToken", :as => :owner
8
+ base.serialize :config, Hash
9
+ base.after_create :fetch_oauth_token
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,7 +1,7 @@
1
1
  require 'jive/tile/version'
2
2
 
3
3
  module Jive
4
- module Tile
4
+ class Tile < ActiveRecord::Base
5
5
  module Compatibility
6
6
  if ActiveSupport::VERSION::MAJOR >= 4
7
7
  require 'active_support/proxy_object'
@@ -1,12 +1,9 @@
1
1
  module Jive
2
- module Tile
3
- class Model < ActiveRecord::Base
4
- self.table_name = :jive_tiles
5
- belongs_to :add_on, :class_name => "Jive::AddOn::Model", :foreign_key => :jive_add_on_id
6
- has_one :oauth_token, :class_name => "Jive::OauthToken::Model", :as => :owner
7
- serialize :config, Hash
8
-
9
- after_create :fetch_oauth_token
2
+ class Tile < ActiveRecord::Base
3
+ module InstanceMethods
4
+ def self.included(base)
5
+ base.table_name = "jive_tiles"
6
+ end
10
7
 
11
8
  private
12
9
  def fetch_oauth_token
@@ -37,7 +34,7 @@ module Jive
37
34
  json_body = JSON.parse(response.body)
38
35
 
39
36
  # Create
40
- Jive::OauthToken::Model.create(
37
+ Jive::OauthToken.create(
41
38
  :owner => self,
42
39
  :scope => json_body["scope"],
43
40
  :token_type => json_body["token_type"],
@@ -1,5 +1,7 @@
1
+ require "active_record"
2
+
1
3
  module Jive
2
- module Tile
3
- VERSION = "0.0.7"
4
+ class Tile < ActiveRecord::Base
5
+ VERSION = "0.0.8"
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jive-tile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Butch Marshall
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-01 00:00:00.000000000 Z
11
+ date: 2016-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -36,28 +36,28 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: 0.0.2
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: 0.0.2
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jive-oauth_token
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: 0.0.3
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: '0'
60
+ version: 0.0.3
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: sqlite3
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -180,8 +180,9 @@ files:
180
180
  - lib/generators/jive/tile/tile_generator.rb
181
181
  - lib/jive/tile.rb
182
182
  - lib/jive/tile/add_on/class_methods.rb
183
+ - lib/jive/tile/class_methods.rb
183
184
  - lib/jive/tile/compatibility.rb
184
- - lib/jive/tile/model.rb
185
+ - lib/jive/tile/instance_methods.rb
185
186
  - lib/jive/tile/version.rb
186
187
  homepage: https://github.com/butchmarshall/ruby-jive-tile
187
188
  licenses: