Class: Youtrack::Models::Base::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/youtrack/models/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, extended: nil, model: nil, type: nil) ⇒ Field

Returns a new instance of Field.



8
9
10
11
12
13
# File 'lib/youtrack/models/base.rb', line 8

def initialize(name:, extended: nil, model: nil, type: nil)
  @name = name
  @extended = extended
  @model = model
  @type = type
end

Instance Attribute Details

#extendedObject

Returns the value of attribute extended.



6
7
8
# File 'lib/youtrack/models/base.rb', line 6

def extended
  @extended
end

#modelObject

Returns the value of attribute model.



6
7
8
# File 'lib/youtrack/models/base.rb', line 6

def model
  @model
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/youtrack/models/base.rb', line 6

def name
  @name
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/youtrack/models/base.rb', line 6

def type
  @type
end

Instance Method Details

#attr_nameObject



32
33
34
# File 'lib/youtrack/models/base.rb', line 32

def attr_name
  name.underscore
end

#extended?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/youtrack/models/base.rb', line 15

def extended?
  extended
end

#to_queryObject



19
20
21
22
23
24
25
26
# File 'lib/youtrack/models/base.rb', line 19

def to_query
  if model.present?
    model_fields = model.minimal_fields
    "#{name}(#{model_fields.map(&:to_query).join(",")})"
  else
    name
  end
end

#to_sObject



28
29
30
# File 'lib/youtrack/models/base.rb', line 28

def to_s
  "Field name=#{name} extended=#{extended} model=#{model} type=#{type}"
end