jive-add_on 0.0.1 → 0.0.2

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: 4be7d97437243712eff1183d857ad2def032287a
4
- data.tar.gz: b29b48e46ea6fd6006af82e054f44bd635b1ab30
3
+ metadata.gz: 9298fdcf5ec5a416ac351a1ecaa99aa06852f166
4
+ data.tar.gz: 82ef53b229f396dbae0d746a00da3be8cc9353d2
5
5
  SHA512:
6
- metadata.gz: 360cc6d99d5f3eb1d25f53fe211fb6ffbeb9714d5c1a401476d9a41929fc8068ee2d155e61237825f0b1343b4d6aedcff1fac0be1bb8aad23b3ad81094905d20
7
- data.tar.gz: adc34e7733d492c3a658986212551f3043ed3eaa949ce34e05391d87ca8af9cb4f2dc991ae87ab8adedf5bc03c372a3d973bd01e5c4472ae310f3c673f620626
6
+ metadata.gz: 7228eec78fc1107b6156a1b1b0d44ef3a7d71ea45a382cc009a8a6326a4b796a7f9feedd8d08815b31d7263b90a08ac4009a24fdf77f064801225d172cbeeb63
7
+ data.tar.gz: 1b59979c421d08e9139101387a83422d56075a77f4bc1604b2c48031766dc021488194961600200e6d47efa79eb1382157707752cb57cc957f1786113d1c436c
data/README.md CHANGED
@@ -32,7 +32,7 @@ rails generate jive:add_on:active_record
32
32
  To the ActiveRecord model:
33
33
 
34
34
  ```ruby
35
- Jive::AddOn::Model.new(...)
35
+ Jive::AddOn.new(...)
36
36
  ```
37
37
 
38
38
  ## Contributing
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Butch Marshall"]
10
10
  spec.email = ["butch.a.marshall@gmail.com"]
11
11
  spec.summary = "Jive AddOn functionality implemented using ActiveRecord."
12
- spec.description = "Implements the functionality required for dealing with and storing Jive AddOns using ActiveRecord as a storage backend.}"
12
+ spec.description = "Implements the functionality required for dealing with and storing Jive AddOns using ActiveRecord as a storage backend."
13
13
  spec.homepage = "https://github.com/butchmarshall/ruby-jive-add_on"
14
14
  spec.license = "MIT"
15
15
 
@@ -34,4 +34,5 @@ Gem::Specification.new do |spec|
34
34
  spec.add_development_dependency "rake", "~> 10.0"
35
35
 
36
36
  spec.add_development_dependency "rspec"
37
+ spec.add_development_dependency "webmock"
37
38
  end
@@ -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 AddOn
8
+ class AddOn < ActiveRecord::Base
9
9
  class ActiveRecordGenerator < ::Jive::AddOn::Generator
10
10
  include Rails::Generators::Migration
11
11
  extend NextMigrationVersion
@@ -2,7 +2,7 @@ require 'rails/generators/base'
2
2
  require 'jive/add_on/compatibility'
3
3
 
4
4
  module Jive
5
- module AddOn
5
+ class AddOn < ActiveRecord::Base
6
6
  class Generator < Rails::Generators::Base
7
7
  source_paths << File.join(File.dirname(__FILE__), 'templates')
8
8
  end
@@ -1,5 +1,5 @@
1
1
  module Jive
2
- module AddOn
2
+ class AddOn < ActiveRecord::Base
3
3
  module NextMigrationVersion
4
4
  # while methods have moved around this has been the implementation
5
5
  # since ActiveRecord 3.0
@@ -6,13 +6,13 @@ require "jive/signed_request"
6
6
 
7
7
  require "jive/add_on/version"
8
8
  require "jive/add_on/compatibility"
9
- require "jive/add_on/model"
9
+ require "jive/add_on/class_methods"
10
+ require "jive/add_on/instance_methods"
10
11
 
11
12
  module Jive
12
- module AddOn
13
+ class AddOn < ActiveRecord::Base
13
14
  end
14
- #def AddOn
15
- # Jive::AddOn::Model
16
- #end
17
- #module_function :AddOn
18
15
  end
16
+
17
+ Jive::AddOn.send :include, Jive::AddOn::InstanceMethods
18
+ Jive::AddOn.send :extend, Jive::AddOn::ClassMethods
@@ -0,0 +1,9 @@
1
+ module Jive
2
+ class AddOn < ActiveRecord::Base
3
+ module ClassMethods
4
+ def self.extended(base)
5
+ base.validate :validate_registration
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,7 +1,7 @@
1
1
  require 'jive/add_on/version'
2
2
 
3
3
  module Jive
4
- module AddOn
4
+ class AddOn < ActiveRecord::Base
5
5
  module Compatibility
6
6
  if ActiveSupport::VERSION::MAJOR >= 4
7
7
  require 'active_support/proxy_object'
@@ -0,0 +1,24 @@
1
+ module Jive
2
+ class AddOn < ActiveRecord::Base
3
+ module InstanceMethods
4
+ def self.included(base)
5
+ base.table_name = :jive_add_ons
6
+ end
7
+
8
+ private
9
+ def validate_registration
10
+ if !::Jive::SignedRequest.validate_registration({
11
+ clientId: self.client_id,
12
+ tenantId: self.tenant_id,
13
+ jiveSignatureURL: self.jive_signature_url,
14
+ clientSecret: self.client_secret,
15
+ jiveSignature: self.jive_signature,
16
+ jiveUrl: self.jive_url,
17
+ timestamp: self.timestamp,
18
+ })
19
+ errors.add(:base, "INVALID_JIVE_SIGNATURE")
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  module Jive
2
- module AddOn
2
+ class AddOn < ActiveRecord::Base
3
3
  class Model < ActiveRecord::Base
4
4
  self.table_name = :jive_add_ons
5
5
  validate :validate_registration
@@ -1,5 +1,7 @@
1
+ require "active_record"
2
+
1
3
  module Jive
2
- module AddOn
3
- VERSION = "0.0.1"
4
+ class AddOn < ActiveRecord::Base
5
+ VERSION = "0.0.2"
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jive-add_on
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-01-02 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
@@ -128,8 +128,22 @@ dependencies:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
+ - !ruby/object:Gem::Dependency
132
+ name: webmock
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
131
145
  description: Implements the functionality required for dealing with and storing Jive
132
- AddOns using ActiveRecord as a storage backend.}
146
+ AddOns using ActiveRecord as a storage backend.
133
147
  email:
134
148
  - butch.a.marshall@gmail.com
135
149
  executables: []
@@ -151,7 +165,9 @@ files:
151
165
  - lib/generators/jive/add_on/next_migration_version.rb
152
166
  - lib/generators/jive/add_on/templates/migration_0.1.0.rb
153
167
  - lib/jive/add_on.rb
168
+ - lib/jive/add_on/class_methods.rb
154
169
  - lib/jive/add_on/compatibility.rb
170
+ - lib/jive/add_on/instance_methods.rb
155
171
  - lib/jive/add_on/model.rb
156
172
  - lib/jive/add_on/version.rb
157
173
  homepage: https://github.com/butchmarshall/ruby-jive-add_on
@@ -174,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
190
  version: '0'
175
191
  requirements: []
176
192
  rubyforge_project:
177
- rubygems_version: 2.4.8
193
+ rubygems_version: 2.4.6
178
194
  signing_key:
179
195
  specification_version: 4
180
196
  summary: Jive AddOn functionality implemented using ActiveRecord.