unidom-accession 2.0 → 2.1

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: 2c28c9f6045d2d26687c9c0c144431b548bb6b38
4
- data.tar.gz: 1ea4ec65b881937750d5c89f0b9894d9a6410d62
3
+ metadata.gz: d4ff407ff9fe6c66453c9fb208b3535da982f4cf
4
+ data.tar.gz: 6b5b87e387d812601ca42b2d691bd83f4ded1c29
5
5
  SHA512:
6
- metadata.gz: 6aab5f807680d486711cb1bdfbe7fba3c5e5f2c9f0ba6bfd213c5fa7a4c472669b892eac47120761484f10bb013c838b7e8a076e92c05eabc14e70243b2e1b55
7
- data.tar.gz: c01c78df846db8535aa4be82039d1646a73aca72858fce4fd17c81443bcfd4dea586897898a25c0d2ead66a5a304cffc76d6a72b09a47a212b1bcc7cedd32457
6
+ metadata.gz: 43751b340c76383ed1be89ce21b802127d7683da36662d46cfb5936a9b56d91b1528b6238eb371bc0f1ac0f536cadd2d1c9f1973e9122c600720d085977a83d1
7
+ data.tar.gz: c4c560a966bb45bcc951818d03227484950ec810016fa88a6ae178dc7786298f81fd07ea0839f0e504823584e05b628f8f734935e02edb427442096436050578
data/README.md CHANGED
@@ -41,9 +41,11 @@ The As Post Fulfilled concern do the following tasks for the includer automatica
41
41
  1. Define the has_many :post_fulfillments macro as: ``has_many :post_fulfillments, class_name: 'Unidom::Accession::PostFulfillment', as: :fulfilled``
42
42
  2. Define the has_many :fulfiller_people macro as: ``has_many :fulfiller_people, through: :post_fulfillments, source: :fulfiller, source_type: 'Unidom::Party::Person'``
43
43
  3. Define the #is_fulfilled_as_post! method as: ``def is_fulfilled_as_post!(by: nil, at: Time.now)``
44
+ 4. Define the #is_fulfilled_as_post? method as: ``def is_fulfilled_as_post?(by: nil, at: Time.now)``
44
45
 
45
46
  ### As Post Fulfiller concern
46
47
  The As Post Fulfiller concern do the following tasks for the includer automatically:
47
48
  1. Define the has_many :post_fulfillments macro as: ``has_many :post_fulfillments, class_name: 'Unidom::Accession::PostFulfillment', as: :fulfiller``
48
49
  2. Define the has_many :fulfilled_posts macro as: ``has_many :fulfilled_posts, through: :post_fulfillments, source: :fulfilled, source_type: 'Unidom::Position::Post'``
49
50
  3. Define the #fulfill_post! method as: ``def fulfill_post!(post, at: Time.now)``
51
+ 4. Define the #fulfill_post? method as: ``def fulfill_post?(post, at: Time.now)``
@@ -7,18 +7,18 @@ module Unidom::Accession::Concerns::AsPostFulfilled
7
7
  has_many :post_fulfillments, class_name: 'Unidom::Accession::PostFulfillment', as: :fulfilled
8
8
  has_many :fulfiller_people, through: :post_fulfillments, source: :fulfiller, source_type: 'Unidom::Party::Person'
9
9
 
10
- #def is_fulfilled_as_post!(by: nil, opened_at: Time.now)
11
- # raise ArgumentError.new('The argument "by" is required.') if by.blank?
12
- # raise ArgumentError.new('The argument "opened_at" is required.') if opened_at.blank?
13
- # post_fulfillments.create! fulfiller: by, opened_at: opened_at
14
- #end
15
-
16
10
  def is_fulfilled_as_post!(by: nil, at: Time.now)
17
11
  raise ArgumentError.new('The by argument is required.') if by.blank?
18
12
  raise ArgumentError.new('The at argument is required.') if at.blank?
19
13
  post_fulfillments.create! fulfiller: by, opened_at: at
20
14
  end
21
15
 
16
+ def is_fulfilled_as_post?(by: nil, at: Time.now)
17
+ raise ArgumentError.new('The by argument is required.') if by.blank?
18
+ raise ArgumentError.new('The at argument is required.') if at.blank?
19
+ post_fulfillments.fulfilled_by(by).valid_at(now: at).exists?
20
+ end
21
+
22
22
  end
23
23
 
24
24
  end
@@ -7,18 +7,18 @@ module Unidom::Accession::Concerns::AsPostFulfiller
7
7
  has_many :post_fulfillments, class_name: 'Unidom::Accession::PostFulfillment', as: :fulfiller
8
8
  has_many :fulfilled_posts, through: :post_fulfillments, source: :fulfilled, source_type: 'Unidom::Position::Post'
9
9
 
10
- #def fulfill_post!(post: nil, opened_at: Time.now)
11
- # raise ArgumentError.new('The argument "post" is required.') if post.blank?
12
- # raise ArgumentError.new('The argument "opened_at" is required.') if opened_at.blank?
13
- # post_fulfillments.create! fulfilled: post, opened_at: opened_at
14
- #end
15
-
16
10
  def fulfill_post!(post, at: Time.now)
17
11
  raise ArgumentError.new('The post argument is required.') if post.blank?
18
12
  raise ArgumentError.new('The at argument is required.' ) if at.blank?
19
13
  post_fulfillments.create! fulfilled: post, opened_at: at
20
14
  end
21
15
 
16
+ def fulfill_post?(post, at: Time.now)
17
+ raise ArgumentError.new('The post argument is required.') if post.blank?
18
+ raise ArgumentError.new('The at argument is required.' ) if at.blank?
19
+ post_fulfillments.fulfilled_is(post).valid_at(now: at).exists?
20
+ end
21
+
22
22
  end
23
23
 
24
24
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Accession
3
- VERSION = '2.0'.freeze
3
+ VERSION = '2.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-accession
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: '2.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-25 00:00:00.000000000 Z
11
+ date: 2016-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common