user_engage 0.0.8 → 0.0.9

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
  SHA256:
3
- metadata.gz: 66d8ad78a363224162ad89c1fb97a6ef92596c41bcc2b3e217f32fa2eb084394
4
- data.tar.gz: 48f234504a5b6ec623ca58311b71129b33cba499ab862d3ad50e84934cf90efa
3
+ metadata.gz: 8e2c0ee1d393b3458f636443eca6e4ac3f85db5ac12429b677c409b0f6b8e630
4
+ data.tar.gz: aa4d2f9926dc708fe453b77e8f1f0ef54c3635ec8b10634b2bea64807c7918c6
5
5
  SHA512:
6
- metadata.gz: 48683a08022329f6958b98f3f8cf119a0b1421aff6868a99a9c71ab61f9e51f718d809ff9f7d7c9017984757b0d36c033df3724f48ece54c022935ebac1c6826
7
- data.tar.gz: 606f8a9e741023d5c67b5070fe63a5ffdce2683f4a4217f72dbfdddbdd40e815685f6fbd720511bb9a3c0c468e519d5a69b5d0d60c370076ae5e2f71fc425f50
6
+ metadata.gz: b053f46f6ee9ed8a30174fc90c4fa0d8fdd123d61e6c7c14ad31bc2a926953ce129ed8c10f109b902a7bcbc5155e09ff3146a788232d72ad52b17fa58e9d34e3
7
+ data.tar.gz: 8984e3823df886fa18390ea03669e9baa65702384b50c11c6c3100b3f91be4fa0ca9b097e3b66135dfea429389add23b8f77ab38ef21027a4fb4e961bd3f552c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- user_engage (0.0.8)
4
+ user_engage (0.0.9)
5
5
  dry-struct (~> 0.5)
6
6
  faraday (>= 0.12)
7
7
 
data/TODO.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Open ToDos:
2
2
  ## Users
3
3
  * [x] Create user
4
- * [ ] Update user
4
+ * [x] Update user
5
5
  * [x] Find user by email
6
6
  * [x] Find user by ID
7
7
  * [x] Find user by key
@@ -25,7 +25,7 @@
25
25
  * [ ] Get user emails
26
26
  ## CRM
27
27
  * [x] Create company
28
- * [ ] Update company
28
+ * [x] Update company
29
29
  * [x] Delete company
30
30
  * [x] Get company
31
31
  * [x] Get all companies
@@ -29,6 +29,12 @@ module UserEngage
29
29
  request(:post, path, parameters)
30
30
  end
31
31
 
32
+ # Public: Calls the base_url with the given path and parameters
33
+ #
34
+ def put(path, parameters = {})
35
+ request(:put, path, parameters)
36
+ end
37
+
32
38
  #####################
33
39
  ## Private methods ##
34
40
  #####################
@@ -5,6 +5,7 @@ require 'user_engage/operation/all'
5
5
  require 'user_engage/operation/create'
6
6
  require 'user_engage/operation/find'
7
7
  require 'user_engage/operation/destroy'
8
+ require 'user_engage/operation/update'
8
9
  require 'user_engage/operation/update_attributes'
9
10
 
10
11
  require 'user_engage/attribute'
@@ -19,6 +20,7 @@ module UserEngage
19
20
  extend Operation::Find
20
21
  extend Operation::Create
21
22
  include Operation::Destroy
23
+ include Operation::Update
22
24
  include Operation::UpdateAttributes
23
25
 
24
26
  ################
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UserEngage
4
+ module Operation
5
+ module Update
6
+ # Public: Updates the resources attributes (not the array)
7
+ # with the given attributes_hash.
8
+ #
9
+ def update(attributes_hash)
10
+ update_remote!(attributes_hash) &&
11
+ update_locally!(attributes_hash)
12
+ end
13
+
14
+ #####################
15
+ ## Private methods ##
16
+ #####################
17
+ private
18
+
19
+ # Private: Request the update of the attributes on UE
20
+ #
21
+ def update_remote!(attributes_hash)
22
+ path = "/#{resource_name}/#{id}/"
23
+ UserEngage.client.put(path, attributes_hash)
24
+ end
25
+
26
+ # Private: Updates the instances attributes
27
+ #
28
+ def update_locally!(attributes_hash)
29
+ attributes_hash.each_pair do |attr_name, value|
30
+ attributes[attr_name.to_sym] = value
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -5,6 +5,7 @@ require 'user_engage/operation/all'
5
5
  require 'user_engage/operation/create'
6
6
  require 'user_engage/operation/find'
7
7
  require 'user_engage/operation/destroy'
8
+ require 'user_engage/operation/update'
8
9
  require 'user_engage/operation/update_attributes'
9
10
 
10
11
  require 'user_engage/attribute'
@@ -20,6 +21,7 @@ module UserEngage
20
21
  extend Operation::Create
21
22
  extend Operation::Find
22
23
  include Operation::Destroy
24
+ include Operation::Update
23
25
  include Operation::UpdateAttributes
24
26
 
25
27
  ################
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UserEngage
4
- VERSION = '0.0.8'
4
+ VERSION = '0.0.9'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: user_engage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schwed
@@ -184,6 +184,7 @@ files:
184
184
  - lib/user_engage/operation/create.rb
185
185
  - lib/user_engage/operation/destroy.rb
186
186
  - lib/user_engage/operation/find.rb
187
+ - lib/user_engage/operation/update.rb
187
188
  - lib/user_engage/operation/update_attributes.rb
188
189
  - lib/user_engage/resource_collection.rb
189
190
  - lib/user_engage/tag.rb