Class: Zendesk2::MarkUserIdentityPrimary
- Inherits:
-
Object
- Object
- Zendesk2::MarkUserIdentityPrimary
show all
- Includes:
- Request
- Defined in:
- lib/zendesk2/mark_user_identity_primary.rb
Instance Attribute Summary
Attributes included from Request
#params
Instance Method Summary
collapse
Methods included from Request
#call, cistern_included, #data, #delete!, #error!, #find!, #html_url_for, included, #mock_response, #page, #page_params!, #page_params?, #pluralize, #real, #real_request, #request_body, #request_params, #request_path, #resources, #response, #timestamp, #url_for
Instance Method Details
#mock ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/zendesk2/mark_user_identity_primary.rb', line 16
def mock
user_identity = find!(:identities, user_identity_id)
other_user_identities = cistern.data[:identities].values.select { |i| i['user_id'] == user_id }
other_user_identities.map { |i| i['primary'] = false }
user_identity['primary'] = true
mock_response(nil)
end
|
#user_id ⇒ Object
8
9
10
|
# File 'lib/zendesk2/mark_user_identity_primary.rb', line 8
def user_id
params.fetch('user_identity').fetch('user_id')
end
|
#user_identity_id ⇒ Object
12
13
14
|
# File 'lib/zendesk2/mark_user_identity_primary.rb', line 12
def user_identity_id
params.fetch('user_identity').fetch('id')
end
|