Sha256: 17574dad4c298315396fe92890a2e7575c2c233bf9284363e0641fdff5b571a2

Contents?: true

Size: 935 Bytes

Versions: 44

Compression:

Stored size: 935 Bytes

Contents

class Zendesk2::Client
  class Real
    def create_topic_comment(params={})
      topic_id = params.delete("topic_id")
      path     = "/topics/#{topic_id}/comments.json"

      request(
        :body   => {"topic_comment" => params},
        :method => :post,
        :path   => path,
      )
    end
  end # Real

  class Mock
    def create_topic_comment(params={})
      identity = self.class.new_id
      topic_id = params["topic_id"]
      path     = "/topics/#{topic_id}/comments.json"

      record = {
        "id"         => identity,
        "url"        => url_for("/topics/#{topic_id}/comments/#{identity}.json"),
        "created_at" => Time.now.iso8601,
        "updated_at" => Time.now.iso8601,
      }.merge(params)

      self.data[:topic_comments][identity]= record

      response(
        :method => :post,
        :body   => {"topic_comment" => record},
        :path   => path,
      )
    end
  end # Mock
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
zendesk2-1.4.2 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.4.1 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.4.0 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.3.3 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.3.2 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.3.1 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.3.0 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.2.10 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.2.9 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.2.7 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.2.6 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.2.5 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.2.4 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.2.3 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.2.2 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.2.1 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.2.0 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.1.3 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.1.2 lib/zendesk2/client/requests/create_topic_comment.rb
zendesk2-1.0.0 lib/zendesk2/client/requests/create_topic_comment.rb