Sha256: e53f0dbabfb708e6c35233be0a397c1db4d0b52394033f07cf52c863ab9179f6

Contents?: true

Size: 1.21 KB

Versions: 18

Compression:

Stored size: 1.21 KB

Contents

module TheCity

  class Metric < ApiObject
    tc_attr_accessor :id,
                     :name,
                     :description,
                     :category,
                     :subcategory,
                     :is_percent         


    # Loads the metric by the specified ID.
    #
    # @param metric_id The ID of the user to load.
    #
    # Returns a new {Metric} object.
    def self.load_by_id(metric_id)
      metric_reader = MetricReader.new(metric_id)
      self.new(metric_reader.load_feed)
    end       


    # Constructor.
    #
    # @param json_data (optional) The object that has the data.
    # @param options (optional) Options for including more information.
    def initialize(json_data = nil, options = {}) 
      @writer_object = MetricWriter
      initialize_from_json_object(json_data) unless json_data.nil?   

      @measurement_list = nil
    end


    # Address information.
    #
    # @return [UserAddressList]
    def measurements
      return @measurement_list unless @measurement_list.nil?  
      return nil unless self.id

      reader = MetricMeasurementListReader.new(self.id)    
      @measurement_list = MetricMeasurementList.new(reader)
      return @measurement_list
    end
  end

end


Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
the-city-admin-0.6.3 lib/api/metric.rb
the-city-admin-0.6.2 lib/api/metric.rb
the-city-admin-0.6.1 lib/api/metric.rb
the-city-admin-0.6.0 lib/api/metric.rb
the-city-admin-0.5.2 lib/api/metric.rb
the-city-admin-0.5.1 lib/api/metric.rb
the-city-admin-0.5.0 lib/api/metric.rb
the-city-admin-0.4.0 lib/api/metric.rb
the-city-admin-0.3.1 lib/api/metric.rb
the-city-admin-0.3.0 lib/api/metric.rb
the-city-admin-0.2.1 lib/api/metric.rb
the-city-admin-0.2.0 lib/api/metric.rb
the-city-admin-0.1.5 lib/api/metric.rb
the-city-admin-0.1.4 lib/api/metric.rb
the-city-admin-0.1.3 lib/api/metric.rb
the-city-admin-0.1.2 lib/api/metric.rb
the-city-admin-0.1.1 lib/api/metric.rb
the-city-admin-0.1.0 lib/api/metric.rb