Sha256: 19025c947414947f5b77725041c17a4da45519c273b473390d144e992d7cfce0

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

class Zendesk2::Client
  class Real
    def create_ticket_field(params={})
      request(
        :body   => {"ticket_field" => params},
        :method => :post,
        :path   => "/ticket_fields.json",
      )
    end
  end # Real

  class Mock
    def create_ticket_field(params={})
      identity = self.class.new_id

      record = {
        "active"                => true,
        "collapsed_for_agents"  => false,
        "created_at"            => Time.now.iso8601,
        "description"           => params["title"],
        "editable_in_portal"    => false,
        "id"                    => identity,
        "position"              => 9999,
        "regexp_for_validation" => nil,
        "required"              => true,
        "required_in_portal"    => false,
        "title_in_portal"       => params["title"],
        "updated_at"            => Time.now.iso8601,
        "url"                   => url_for("/ticket_fields/#{identity}.json"),
        "visible_in_portal"     => false,
      }.merge(params)

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

      response(
        :method => :post,
        :body   => {"ticket_field" => record},
        :path   => "/ticket_fields.json"
      )
    end
  end # Mock
end # Zendesk2::Client

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zendesk2-0.4.1 lib/zendesk2/client/requests/create_ticket_field.rb