infopark-crm-helpers 1.2.2 → 1.3.0
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 +4 -4
- data/.travis.yml +2 -2
- data/README.md +16 -0
- data/changelog.md +5 -0
- data/lib/crm/helpers/persistence.rb +7 -3
- data/lib/crm/helpers/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ba796ea303bb2e169c28a4cd97e59c31097af9a
|
4
|
+
data.tar.gz: 6c8f36fa129809d0c2da371f213761f23cd0c57e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8feac9ad864182321d2daacedbc69e17a043e84f3aaccf3ffd18d9b5e46c4e12cf50201845b4ed81dfcea0d39a6a8ba64ad0d93d4a4a737a160dd99c2cb29b40
|
7
|
+
data.tar.gz: dfd67fb39726440b0d0e22d1d93c44e0b16454ca5d90be2a9e33156f2b6904eb3cd640774399b83cc462f6a1163724914ec0ef0f36b2745a539fefe7abb9567d
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -30,6 +30,22 @@ bundle install
|
|
30
30
|
|
31
31
|
No direct configuration of `infopark-crm-helpers` is required. Refer to [infopark/webcrm_sdk](https://github.com/infopark/webcrm_sdk#configuration) for instructions on setting up your installation of `infopark_webcrm_sdk`.
|
32
32
|
|
33
|
+
### Run specs
|
34
|
+
|
35
|
+
Add your CRM credentials to `.crm.yml` in the root folder of this project.
|
36
|
+
|
37
|
+
```yaml
|
38
|
+
tenant: your-tenant-here
|
39
|
+
login: john.smith@example.org
|
40
|
+
api_key: 1234567890abcdefghijklmnopqrstuvwxyz
|
41
|
+
```
|
42
|
+
|
43
|
+
Then invoke:
|
44
|
+
|
45
|
+
```
|
46
|
+
bundle exec rake spec
|
47
|
+
```
|
48
|
+
|
33
49
|
## Examples
|
34
50
|
|
35
51
|
### Create your own class
|
data/changelog.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
### 1.3.0
|
2
|
+
|
3
|
+
- Add `Crm::Helpers::Persistence.create!`.
|
4
|
+
- An instance of `Crm::Errors::InvalidValues` is raised for `!`-methods, if an invalid object is to be persisted.
|
5
|
+
|
1
6
|
### 1.2.2
|
2
7
|
|
3
8
|
- Allow indifferent access on the hash passed in whilst creating an object.
|
@@ -9,9 +9,13 @@ module Crm
|
|
9
9
|
def create(attributes = {})
|
10
10
|
attributes = attributes.with_indifferent_access
|
11
11
|
instance = new(attributes)
|
12
|
-
|
12
|
+
instance.save! unless instance.invalid?
|
13
|
+
instance
|
14
|
+
end
|
13
15
|
|
14
|
-
|
16
|
+
def create!(attributes = {})
|
17
|
+
instance = create(attributes)
|
18
|
+
raise Crm::Errors::InvalidValues.new('', instance.errors) if instance.invalid?
|
15
19
|
instance
|
16
20
|
end
|
17
21
|
end
|
@@ -33,7 +37,7 @@ module Crm
|
|
33
37
|
|
34
38
|
def update!(attributes = {})
|
35
39
|
assign_crm_attributes(attributes)
|
36
|
-
raise
|
40
|
+
raise Crm::Errors::InvalidValues.new('', self.errors) if invalid?
|
37
41
|
|
38
42
|
persist
|
39
43
|
end
|
data/lib/crm/helpers/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infopark-crm-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Huy Dinh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|