Sha256: 6f8816aaef10a4e548180289924a8ba3c42730cea3b4855851cf44f5be0aadc7
Contents?: true
Size: 797 Bytes
Versions: 18
Compression:
Stored size: 797 Bytes
Contents
class Zendesk2::Client class Real def get_user(params={}) id = params["id"] request( :method => :get, :path => "/users/#{id}.json" ) end end # Real class Mock def get_user(params={}) id = params["id"] if body = self.data[:users][id] identities = self.data[:identities].values.select{|i| i["user_id"] == id} identity = identities.find{|i| i["type"] == "email" && i["primary"]} || identities.find{|i| i["type"] == "email"} # @todo what happens if no identity? response( :path => "/users/#{id}.json", :body => { "user" => body.merge("email" => identity["value"]), }, ) else response(status: 404) end end end # Mock end
Version data entries
18 entries across 18 versions & 1 rubygems