tramway-partner 1.0.2 → 1.0.3

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
  SHA256:
3
- metadata.gz: b3cca6d291cbb11be257d6b6b58c123cae8ed45e6b24a0934b08bbdf2c07ac74
4
- data.tar.gz: 6027fc7347587acb5e071bdf8e3d637d64ac5bbc4914a89c1571a0540ad52c32
3
+ metadata.gz: 6082a154190dbfc7b870c641e5048c8cfff042b2612220dc17e9364c3c1487f1
4
+ data.tar.gz: e53b84b0a40f4c4acdb1590da5c1e364af8aa25a1e216c617c45ef5db67505ef
5
5
  SHA512:
6
- metadata.gz: 386c65a439a885ee1dacbb2a23fff9d748cb99353418c6d27e0670785b775012b9f9d22c2ab144705af8e1d575507686adf32c7d756a878a56502aae124570cb
7
- data.tar.gz: eabb0a5dca37f839c7fc3415f3b1053b0d5c131f0fb49f379af03b5abda77a02ddc9ceb4c4d1b2c42651035b16fbd73c783f42b51830fe8318a8c8c620ccee93
6
+ metadata.gz: 2371b270b2d736d3b00b0adbc947241064383ab80877fe2be18195f9c76a78da361381ee817dd748cd71c001c0a0912045d488f210268b434d7a9e9916ea48b1
7
+ data.tar.gz: 75fe2f90fe5be3452bd3732d9c24f568b7f75eafe1ce698ed54b7e9e429a9a327e6f0753b0066c87f8bdd754644ce993aec7e60a6402acab394f7f5b235487d1
@@ -0,0 +1,17 @@
1
+ module Tramway::Partner::Scopes
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ ::Tramway::Partner::Partnership.partnership_type.values.each do |partnership_type|
6
+ define_method partnership_type.pluralize.to_sym do
7
+ query = <<-SQL
8
+ tramway_partner_partnerships.partnership_type = '#{partnership_type}'
9
+ AND tramway_partner_partnerships.partner_id = '#{id}'
10
+ AND tramway_partner_partnerships.state = 'active'
11
+ AND tramway_partner_partnerships.partner_type = '#{self.class.name}'
12
+ SQL
13
+ Tramway::Partner::Organization.joins(:partnerships).where(query)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Partner
3
- VERSION = '1.0.2'
3
+ VERSION = '1.0.3'
4
4
  end
5
5
  end
@@ -1,5 +1,6 @@
1
1
  require "tramway/partner/engine"
2
2
  require 'tramway/partner/generators/install_generator'
3
+ require 'tramway/partner/scopes'
3
4
 
4
5
  module Tramway
5
6
  module Partner
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-partner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-24 00:00:00.000000000 Z
11
+ date: 2019-01-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for partners
14
14
  email:
@@ -45,6 +45,7 @@ files:
45
45
  - lib/tramway/partner/generators/install_generator.rb
46
46
  - lib/tramway/partner/generators/templates/create_tramway_partner_organizations.rb
47
47
  - lib/tramway/partner/generators/templates/create_tramway_partner_partnerships.rb
48
+ - lib/tramway/partner/scopes.rb
48
49
  - lib/tramway/partner/version.rb
49
50
  homepage: https://github.com/ulmic/tramway-partner
50
51
  licenses: