Sha256: e7decbbcb786e4cc76867a90b6bc68ef9b32649a3a7ee3ae9e0d993272b844d7
Contents?: true
Size: 1 KB
Versions: 17
Compression:
Stored size: 1 KB
Contents
class Zendesk2::Client class Real def mark_user_identity_primary(params={}) id = params.delete("id") user_id = params.delete("user_id") path = "/users/#{user_id}/identities/#{id}/make_primary.json" request( :method => :put, :path => path, ) end end class Mock def mark_user_identity_primary(params={}) id = params.delete("id") user_id = params.delete("user_id") path = "/users/#{user_id}/identities/#{id}/make_primary.json" user_identity = self.find!(:identities, id) if user_identity && user_identity["user_id"] == user_id # only one user can be primary other_user_identities = self.data[:identities].values.select{|i| i["user_id"] == user_id} other_user_identities.map{|i| i["primary"] = false} user_identity["primary"] = true response( :method => :put, :path => path ) else error!(:not_found) end end end end
Version data entries
17 entries across 17 versions & 1 rubygems