infopark-crm-helpers 1.2.2 → 1.3.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: 1826ace8dcd04ae4fd8153934762c80c9fb6c61d
4
- data.tar.gz: 6d323d33bdd3765440e68027d043952c9a8e247e
3
+ metadata.gz: 8ba796ea303bb2e169c28a4cd97e59c31097af9a
4
+ data.tar.gz: 6c8f36fa129809d0c2da371f213761f23cd0c57e
5
5
  SHA512:
6
- metadata.gz: c099cc46d0d385c15f153a1a57389fbd59e28c2989faed067292876e711508c385b5e5e2d7a5afec92f39991ab2c152a0533bd5451bfd4a6e85fe2d269e177cd
7
- data.tar.gz: c6eaa84edb213da47f7175cb8876660f26ba943a9fa164bf640eb4960faf5b3c9df88447215fa9810952ab5b81cad7c94b4ff7a9e7b83605491b02731a79e5ef
6
+ metadata.gz: 8feac9ad864182321d2daacedbc69e17a043e84f3aaccf3ffd18d9b5e46c4e12cf50201845b4ed81dfcea0d39a6a8ba64ad0d93d4a4a737a160dd99c2cb29b40
7
+ data.tar.gz: dfd67fb39726440b0d0e22d1d93c44e0b16454ca5d90be2a9e33156f2b6904eb3cd640774399b83cc462f6a1163724914ec0ef0f36b2745a539fefe7abb9567d
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.1
4
- - 2.2.5
3
+ - 2.3.3
4
+ - 2.2.6
5
5
  - 2.1.10
6
6
 
7
7
  before_install: gem install bundler -v 1.11.2
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
@@ -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
- return instance if instance.invalid?
12
+ instance.save! unless instance.invalid?
13
+ instance
14
+ end
13
15
 
14
- instance.save!
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 "#{self.class.name} object is invalid." if invalid?
40
+ raise Crm::Errors::InvalidValues.new('', self.errors) if invalid?
37
41
 
38
42
  persist
39
43
  end
@@ -1,5 +1,5 @@
1
1
  module Crm
2
2
  module Helpers
3
- VERSION = '1.2.2'.freeze
3
+ VERSION = '1.3.0'.freeze
4
4
  end
5
5
  end
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.2.2
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: 2016-12-08 00:00:00.000000000 Z
11
+ date: 2017-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport