user_engage 0.0.8 → 0.0.9
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/Gemfile.lock +1 -1
- data/TODO.md +2 -2
- data/lib/user_engage/client.rb +6 -0
- data/lib/user_engage/company.rb +2 -0
- data/lib/user_engage/operation/update.rb +35 -0
- data/lib/user_engage/user.rb +2 -0
- data/lib/user_engage/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e2c0ee1d393b3458f636443eca6e4ac3f85db5ac12429b677c409b0f6b8e630
|
4
|
+
data.tar.gz: aa4d2f9926dc708fe453b77e8f1f0ef54c3635ec8b10634b2bea64807c7918c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b053f46f6ee9ed8a30174fc90c4fa0d8fdd123d61e6c7c14ad31bc2a926953ce129ed8c10f109b902a7bcbc5155e09ff3146a788232d72ad52b17fa58e9d34e3
|
7
|
+
data.tar.gz: 8984e3823df886fa18390ea03669e9baa65702384b50c11c6c3100b3f91be4fa0ca9b097e3b66135dfea429389add23b8f77ab38ef21027a4fb4e961bd3f552c
|
data/Gemfile.lock
CHANGED
data/TODO.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Open ToDos:
|
2
2
|
## Users
|
3
3
|
* [x] Create user
|
4
|
-
* [
|
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
|
-
* [
|
28
|
+
* [x] Update company
|
29
29
|
* [x] Delete company
|
30
30
|
* [x] Get company
|
31
31
|
* [x] Get all companies
|
data/lib/user_engage/client.rb
CHANGED
@@ -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
|
#####################
|
data/lib/user_engage/company.rb
CHANGED
@@ -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
|
data/lib/user_engage/user.rb
CHANGED
@@ -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
|
################
|
data/lib/user_engage/version.rb
CHANGED
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.
|
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
|