Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
embed_workflow (0.2.0)
embed_workflow (0.2.1)

GEM
remote: https://rubygems.org/
Expand Down
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,13 @@ EmbedWorkflow::Actions.activities(hashid: "7l0al")
### Upsert a user

```ruby
config = {
user_data: {
foo: "bar"
},
}
data = { foo: "bar" }

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

# Updating a user
EmbedWorkflow::Users.upsert(name: "Jane Smith", id: user["id"], config: config)
EmbedWorkflow::Users.upsert(name: "Jane Smith", id: user["id"], data: data)
```

### Fetch a user
Expand Down
5 changes: 3 additions & 2 deletions lib/embed_workflow/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ class << self

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

def upsert(key:, name: nil, email: nil, config: nil)
def upsert(key:, name: nil, email: nil, data: nil, groups: nil)
attrs = {
key: key,
name: name,
email: email,
config: config
data: data,
groups: groups
}.compact

put_request(
Expand Down
2 changes: 1 addition & 1 deletion lib/embed_workflow/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module EmbedWorkflow
VERSION = "0.2.0"
VERSION = "0.2.1"
end
8 changes: 4 additions & 4 deletions spec/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

context "with all parameters" do
before do
config = { user_data: { foo: "bar" } }
data = { foo: "bar" }
allow_any_instance_of(EmbedWorkflow::Client)
.to receive(:put_request)
.with({
Expand All @@ -91,19 +91,19 @@
key: "api-user-1",
name: "Jane Doe",
email: "jane@example.com",
config: config
data: data
}
})
.and_return("response")
end

it "sends the correct parameters to the users API" do
config = { user_data: { foo: "bar" } }
data = { foo: "bar" }
EmbedWorkflow::Users.upsert(
key: "api-user-1",
name: "Jane Doe",
email: "jane@example.com",
config: config
data: data
)
end
end
Expand Down
Loading