Class: Radar::API::Result

Inherits:
Thrift::Union
  • Object
show all
Includes:
Thrift::Struct_Union
Defined in:
lib/radar/api/radar_types.rb

Constant Summary collapse

TABLE =
1
PIE_CHART =
2
LINE_CHART =
3
BAR_CHART =
4
FIELDS =
{
  TABLE => {:type => ::Thrift::Types::STRUCT, :name => 'table', :class => ::Radar::API::Table},
  PIE_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'pie_chart', :class => ::Radar::API::PieChart},
  LINE_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'line_chart', :class => ::Radar::API::LineChart},
  BAR_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'bar_chart', :class => ::Radar::API::BarChart}
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.bar_chart(val) ⇒ Object



443
444
445
# File 'lib/radar/api/radar_types.rb', line 443

def bar_chart(val)
  Result.new(:bar_chart, val)
end

.line_chart(val) ⇒ Object



439
440
441
# File 'lib/radar/api/radar_types.rb', line 439

def line_chart(val)
  Result.new(:line_chart, val)
end

.pie_chart(val) ⇒ Object



435
436
437
# File 'lib/radar/api/radar_types.rb', line 435

def pie_chart(val)
  Result.new(:pie_chart, val)
end

.table(val) ⇒ Object



431
432
433
# File 'lib/radar/api/radar_types.rb', line 431

def table(val)
  Result.new(:table, val)
end

Instance Method Details

#struct_fieldsObject



460
# File 'lib/radar/api/radar_types.rb', line 460

def struct_fields; FIELDS; end

#validateObject

Raises:

  • (StandardError)


462
463
464
# File 'lib/radar/api/radar_types.rb', line 462

def validate
  raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
end