Sha256: 65b6941925650d90bb030953e3cacb2102812d0bfd4d76589fa3887a6a1e4952
Contents?: true
Size: 1.02 KB
Versions: 26
Compression:
Stored size: 1.02 KB
Contents
class Zendesk2::Client class Real def create_user_identity(params={}) user_id = params.delete("user_id") request( :body => {"identity" => params}, :method => :post, :path => "/users/#{user_id}/identities.json", ) end end # Real class Mock def create_user_identity(params={}) identity = self.class.new_id user_id = params["user_id"] record = { "id" => identity, "url" => url_for("/user/#{user_id}/identities/#{identity}.json"), "created_at" => Time.now.iso8601, "updated_at" => Time.now.iso8601, "verified" => false, "primary" => false, }.merge(params) record.merge("primary" => true) if self.data[:identities].values.find{|ui| ui["user_id"] == user_id}.nil? self.data[:identities][identity] = record response( :method => :post, :path => "/user/#{user_id}/identities.json", :body => {"identity" => record} ) end end # Mock end
Version data entries
26 entries across 26 versions & 1 rubygems