pricing_observer 0.1.4 → 0.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 265e3065c12006d412c3ee85b2faac8d83e2f6cc
4
- data.tar.gz: a0845ab079c5dd33219e711e29744088fea80e42
3
+ metadata.gz: c6de3e7fe38515e671b95aa179e1ff6b9e7f81fc
4
+ data.tar.gz: ed9e58cc44de9b44dc183d8c97c9b85e98d93f77
5
5
  SHA512:
6
- metadata.gz: 40ad566b733e773a0ea5ee2381af960598a303ef5b92c9f3157e2367f2176ef145d2b94ab0fea977068bd1e50361a3ec78fefc4cfbf9308317e9233ab68daaa9
7
- data.tar.gz: 596296c67570eaf294f3e91a674a8a3a8f461c277dd341d95930f83a6b70362c375d9bc4dffeee4cb520b95094adb3896702ce539f182d7aec404b9b8dade8fd
6
+ metadata.gz: c34d2f9d17cea0be066f7ed75414fe9026075f84be6adea064e1a6a9d3df44c164793956b95d8eb6f751ce2f60099dd1b052890a52ce26963e3857177d7f0cde
7
+ data.tar.gz: 2107513d5c130f04722c0850e6ccacd437def2ad6fbbe6f9284839a61321730280794a36c06114b02a9839e43644f626f896ff425c290b1aa6b793de129bec5f
@@ -1,3 +1,3 @@
1
1
  module PricingObserver
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -1,17 +1,22 @@
1
1
  require "pricing_observer/version"
2
+ #this observer pattern provides reusability class that helps to produce a dynamic pricing strategy for all the products every time the order is confirmed.
2
3
  class OrderSend
4
+ #this method initializes the observer array to store the observable objects
3
5
  def initialize
4
6
  @observers=[]
5
7
  end
6
-
8
+
9
+ #adds the observable objects into class
7
10
  def add_observer(observer)
8
11
  @observers << observer
9
12
  end
10
13
 
14
+ #deletes the observable objects from the class
11
15
  def delete_observer(observer)
12
16
  @observers.delete(observer)
13
17
  end
14
18
 
19
+ #notify's the observer when an desired condition is triggered
15
20
  def notify_observers
16
21
  @observers.each do |observer|
17
22
  puts "Notifying"
@@ -21,13 +26,14 @@ class OrderSend
21
26
  end
22
27
  end
23
28
 
24
-
29
+ #this prcing class is the oberser class that triggers the observer functionality
25
30
  class Pricing
31
+ #this method initializes the class and adds the observer object to observer class
26
32
  def initialize(order)
27
33
  order.add_observer(self)
28
34
  puts "observer initialized"
29
35
  end
30
-
36
+ #this is the logical pricing method that is triggered by the observer when ever the condition is met to be executed.
31
37
  def pricing_by_hit
32
38
  #order_record = OrderItem.last
33
39
  #prod = Product.find(order_record.product_id)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pricing_observer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kishore Kumar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-11 00:00:00.000000000 Z
11
+ date: 2017-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler