unidom-position 0.2 → 1.0

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: 07ee6b61a5feaa110f8bd40d79613884d7bc3fdd
4
- data.tar.gz: df3c400795aa75d11a612fa7914a7187a43cc5c0
3
+ metadata.gz: 1645f47e2078c818ae2521a0fa4e2621ddcc112a
4
+ data.tar.gz: e3300b3cf9f605a7c9844157142fce0a2555a638
5
5
  SHA512:
6
- metadata.gz: bf03a0b9c7184c3c8be7f782f81551deb0900e04a7be0875597ddffabbc41f2acf4609382542c458725ccf2b95201f0ed009e50d1ff60d31c1e9134d5cbb453b
7
- data.tar.gz: c42c01194678ea6ac6a97e6ddabf10e9a03db953a355d2b8d9f1e8801f156ccf3aaefda70b40d375f8e037218bf864a99d331cc172b250afefaf0d404fc0d47d
6
+ metadata.gz: 4f67b7a15021ba82e057f6c8c5a0dbff3eb4f29d05ae8f40ddf8ddc22d1f29b04eabdde53ab2fa0e04d1403d2a8d42f2e4eb244bd65e65448df46a5a51d40c80
7
+ data.tar.gz: 14c43856faaeaf8b44c66dd484711eaec3a260212bf9ab634401d3cb5f3061bcf26d665fd80ed880c429e044b65256eee6cd63b24cf9b079bb13201b6fbf5cef
data/README.md CHANGED
@@ -23,12 +23,16 @@ The migration versions start with 200101.
23
23
 
24
24
  ## Call the Model
25
25
  ```ruby
26
- position = Unidom::Position::Position.valid_at.alive.first
27
26
 
28
27
  occupation = Unidom::Position::Occupation.valid_at.alive.first
29
28
 
29
+ position = Unidom::Position::Position.valid_at.alive.first
30
+
30
31
  post = Unidom::Position::Post.valid_at.alive.first
31
32
 
32
- Unidom::Position::PostReportingStructure.report!(superior_post, inferior_post)
33
+ chief_programmer = Unidom::Position::Post.create! name: 'Chief Programmer', position: position
34
+ erlang_developer = Unidom::Position::Post.create! name: 'Erlang Developer', position: position
35
+
36
+ Unidom::Position::PostReportingStructure.report!(superior_post: chief_programmer, inferior_post: erlang_developer, opened_at: Time.now, elemental: true)
33
37
 
34
38
  ```
@@ -12,7 +12,9 @@ class Unidom::Position::PostReportingStructure < ActiveRecord::Base
12
12
  scope :superior_post_is, ->(superior_post) { where superior_post_id: to_id(superior_post) }
13
13
  scope :inferior_post_is, ->(inferior_post) { where inferior_post_id: to_id(inferior_post) }
14
14
 
15
- def self.report!(superior_post, inferior_post, opened_at = Time.now, elemental = true)
15
+ def self.report!(superior_post: nil, inferior_post: nil, opened_at: Time.now, elemental: true)
16
+ raise ArgumentError.new('The superior_post argument is required.') if superior_post.blank?
17
+ raise ArgumentError.new('The inferior_post argument is required.') if inferior_post.blank?
16
18
  self.inferior_post_is(inferior_post).superior_post_is(superior_post).valid_at.alive.first_or_create! opened_at: opened_at, elemental: elemental
17
19
  end
18
20
 
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Position
3
- VERSION = '0.2'.freeze
3
+ VERSION = '1.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-position
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '1.0'
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-06-24 00:00:00.000000000 Z
11
+ date: 2016-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common