Skip to content

Commit b14791f

Browse files
authored
replace config with data for users upsert (#12)
* replace config with data for users upsert * bundle * fix specs
1 parent 36e236a commit b14791f

File tree

5 files changed

+12
-15
lines changed

5 files changed

+12
-15
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
embed_workflow (0.2.0)
4+
embed_workflow (0.2.1)
55

66
GEM
77
remote: https://rubygems.org/

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,13 @@ EmbedWorkflow::Actions.activities(hashid: "7l0al")
127127
### Upsert a user
128128

129129
```ruby
130-
config = {
131-
user_data: {
132-
foo: "bar"
133-
},
134-
}
130+
data = { foo: "bar" }
135131

136132
# Adding a new user
137-
user = EmbedWorkflow::Users.upsert(key: "api-user-1", name: "Jane Doe", email: "jane@embedworkflow.com", config: config)
133+
user = EmbedWorkflow::Users.upsert(key: "api-user-1", name: "Jane Doe", email: "jane@embedworkflow.com", data: data)
138134

139135
# Updating a user
140-
EmbedWorkflow::Users.upsert(name: "Jane Smith", id: user["id"], config: config)
136+
EmbedWorkflow::Users.upsert(name: "Jane Smith", id: user["id"], data: data)
141137
```
142138

143139
### Fetch a user

lib/embed_workflow/users.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ class << self
1111

1212
RESOURCE_BASE_PATH = "#{BASE_API_PATH}/users".freeze
1313

14-
def upsert(key:, name: nil, email: nil, config: nil)
14+
def upsert(key:, name: nil, email: nil, data: nil, groups: nil)
1515
attrs = {
1616
key: key,
1717
name: name,
1818
email: email,
19-
config: config
19+
data: data,
20+
groups: groups
2021
}.compact
2122

2223
put_request(

lib/embed_workflow/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module EmbedWorkflow
4-
VERSION = "0.2.0"
4+
VERSION = "0.2.1"
55
end

spec/users_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383
context "with all parameters" do
8484
before do
85-
config = { user_data: { foo: "bar" } }
85+
data = { foo: "bar" }
8686
allow_any_instance_of(EmbedWorkflow::Client)
8787
.to receive(:put_request)
8888
.with({
@@ -91,19 +91,19 @@
9191
key: "api-user-1",
9292
name: "Jane Doe",
9393
email: "jane@example.com",
94-
config: config
94+
data: data
9595
}
9696
})
9797
.and_return("response")
9898
end
9999

100100
it "sends the correct parameters to the users API" do
101-
config = { user_data: { foo: "bar" } }
101+
data = { foo: "bar" }
102102
EmbedWorkflow::Users.upsert(
103103
key: "api-user-1",
104104
name: "Jane Doe",
105105
email: "jane@example.com",
106-
config: config
106+
data: data
107107
)
108108
end
109109
end

0 commit comments

Comments
 (0)