Class: TheCity::MetricMeasurementValues
- Includes:
- Enumerable
- Defined in:
- lib/api/metric_measurement_values.rb
Instance Attribute Summary
Attributes inherited from ApiObject
#error_messages, #marked_for_destruction
Class Method Summary collapse
-
.load_by_id(metric_id) ⇒ Object
Loads the metric measurement values by the specified metric ID.
Instance Method Summary collapse
-
#[](index) ⇒ Object
Get the specified account admin privilege.
-
#each(&block) ⇒ Object
This method is needed for Enumerable.
-
#empty? ⇒ Boolean
Checks if the list is empty.
-
#initialize(options = {}) ⇒ MetricMeasurementValues
constructor
Constructor.
Methods inherited from ApiObject
__tc_attributes, #delete, #initialize_from_json_object, #is_deleted?, #save, #set_attributes, tc_attr_accessor, #to_attributes
Constructor Details
#initialize(options = {}) ⇒ MetricMeasurementValues
Constructor.
Options:
:metric_id - The ID of the metric to load the measurements values for. (required)
:reader - The Reader to use to load the data.
Examples:
MetricMeasurementValues.new({:metric_id => 12345})
32 33 34 35 |
# File 'lib/api/metric_measurement_values.rb', line 32 def initialize( = {}) [:reader] = TheCity::MetricMeasurementValuesReader.new() if [:reader].nil? @json_data = [:reader].load_feed end |
Class Method Details
.load_by_id(metric_id) ⇒ Object
Loads the metric measurement values by the specified metric ID.
Returns a new TheCity::Metric object.
14 15 16 17 |
# File 'lib/api/metric_measurement_values.rb', line 14 def self.load_by_id(metric_id) metric_reader = MetricReader.new(metric_id) self.new(metric_reader.load_feed) end |
Instance Method Details
#[](index) ⇒ Object
Get the specified account admin privilege.
42 43 44 |
# File 'lib/api/metric_measurement_values.rb', line 42 def [](index) @json_data['values'][index] if @json_data['values'][index] end |
#each(&block) ⇒ Object
This method is needed for Enumerable.
48 49 50 |
# File 'lib/api/metric_measurement_values.rb', line 48 def each &block @json_data['values'].each{ |value| yield(value) } end |
#empty? ⇒ Boolean
Checks if the list is empty.
58 59 60 |
# File 'lib/api/metric_measurement_values.rb', line 58 def empty? @json_data['values'].empty? end |