spree_loyalty_points 1.0.1 → 1.0.2

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
@@ -10,7 +10,7 @@ Installation
10
10
  Add spree_loyalty_points to your Gemfile:
11
11
 
12
12
  ```ruby
13
- gem 'spree_loyalty_points', '~> 1.0.0'
13
+ gem 'spree_loyalty_points', '~> 1.0.2'
14
14
  ```
15
15
 
16
16
  Bundle your dependencies and run the installation generator:
@@ -5,6 +5,10 @@ module Spree
5
5
  module LoyaltyPoints
6
6
  extend ActiveSupport::Concern
7
7
 
8
+ included do
9
+ scope :by_loyalty_points, -> { joins(:payment_method).readonly(false).where(:spree_payment_methods => { type: 'Spree::PaymentMethod::LoyaltyPoints'}) }
10
+ end
11
+
8
12
  module ClassMethods
9
13
 
10
14
  def any_with_loyalty_points?
@@ -1,4 +1,3 @@
1
- #TODO -> Rspecs for this model.
2
1
  Spree::AppConfiguration.class_eval do
3
2
  preference :min_amount_required_to_get_loyalty_points, :decimal, :default => 20.0
4
3
  preference :loyalty_points_awarding_unit, :decimal, :default => 0.0
@@ -12,13 +12,10 @@ module Spree
12
12
  validate :source_or_comment_present
13
13
  validate :transactions_total_range, if: -> { source.present? && source.loyalty_points_transactions.present? }
14
14
 
15
- #TODO -> rspecs missing for this scope
16
15
  scope :for_order, ->(order) { where(source: order) }
17
16
 
18
- #TODO -> Rspecs missing for this callback.
19
17
  before_create :generate_transaction_id
20
18
 
21
- #TODO -> Rspecs missing for this method.
22
19
  def transaction_type
23
20
  CLASS_TO_TRANSACTION_TYPE[type]
24
21
  end
@@ -5,7 +5,6 @@ Spree::Payment.class_eval do
5
5
 
6
6
  validates :amount, numericality: { greater_than: 0 }, :if => :by_loyalty_points?
7
7
  scope :state_not, ->(s) { where('state != ?', s) }
8
- scope :by_loyalty_points, -> { joins(:payment_method).readonly(false).where(:spree_payment_methods => { type: 'Spree::PaymentMethod::LoyaltyPoints'}) }
9
8
 
10
9
  fsm = self.state_machines[:state]
11
10
  fsm.after_transition :from => fsm.states.map(&:name) - [:completed], :to => [:completed], :do => :notify_paid_order
@@ -1,7 +1,9 @@
1
1
  Spree::PaymentMethod.class_eval do
2
2
 
3
+ scope :loyalty_points_type, -> { where(type: 'Spree::PaymentMethod::LoyaltyPoints') }
4
+
3
5
  def self.loyalty_points_id_included?(method_ids)
4
- where(type: 'Spree::PaymentMethod::LoyaltyPoints').where(id: method_ids).size != 0
6
+ loyalty_points_type.where(id: method_ids).size != 0
5
7
  end
6
8
 
7
9
  end
@@ -1,5 +1,3 @@
1
- #TODO -> Rspecs missing
2
- #TODO -> Add description of this rake task in README and also tell them to create a cron job for this.
3
1
  namespace :spree do
4
2
  namespace :loyalty_points do
5
3
  desc "Credit loyalty points to pending users accounts"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_loyalty_points
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jatin Baweja
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2014-02-27 00:00:00 Z
19
+ date: 2014-03-05 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: spree_core