Sha256: 8271a2df3c96d2d69c4bd8009fac1e0f2070d34ca4ad56e8e2787b6474af953a
Contents?: true
Size: 709 Bytes
Versions: 14
Compression:
Stored size: 709 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"] 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" => find!(:users, id).merge("email" => identity["value"]), }, ) end end # Mock end
Version data entries
14 entries across 14 versions & 1 rubygems