Sha256: 540df0e2da9579d387743eb228821cf98bb2ba2a6068483d0ab6738d6e070c60

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

# frozen_string_literal: true

module Tanita
  module Api
    module Client
      class BaseEntity
        def initialize(property_values = {})
          @cached_property_values = {}
          @cached_property_values.merge!(property_values)
        end

        def to_h
          ret = {}
          self.class.properties.each do |property|
            ret[property.to_sym] = eval property.to_s
          end
          ret
        end

        def inspect
          "\#<#{self.class}:#{object_id} properties=#{self.class.properties.join(',')}>"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tanita-api-client-0.5.0 lib/tanita/api/client/base_entity.rb
tanita-api-client-0.4.1 lib/tanita/api/client/base_entity.rb
tanita-api-client-0.4.0 lib/tanita/api/client/base_entity.rb
tanita-api-client-0.3.1 lib/tanita/api/client/base_entity.rb