class TeamCity::ElementBuilder

Public Class Methods

new(attributes = {}) { |properties| ... } click to toggle source
# File lib/teamcity/element_builder.rb, line 3
def initialize(attributes = {}, &block)
  @payload = attributes

  if block_given?
    @payload['properties'] ||= {}
    @payload['properties']['property'] ||= []

    properties = {}

    yield(properties)

    properties.each do |name, value|
      @payload['properties']['property'] << {
        :name  => name,
        :value => value
      }
    end
  end
end

Public Instance Methods

to_request_body() click to toggle source
# File lib/teamcity/element_builder.rb, line 23
def to_request_body
  @payload.to_json
end