Module: Quandl::Data::Attributes

Extended by:
ActiveSupport::Concern
Included in:
Quandl::Data
Defined in:
lib/quandl/data/attributes.rb

Instance Method Summary collapse

Instance Method Details

#as_jsonObject



40
41
42
43
# File 'lib/quandl/data/attributes.rb', line 40

def as_json
  ensure_json_support
  data_array.try(:as_json)
end

#initialize(*args) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/quandl/data/attributes.rb', line 25

def initialize(*args)
  # passed an instance of quandl data?
  if args.first.kind_of?(Quandl::Data)
    @attributes = args.first.attributes
  elsif args.first.present?
    self.pristine_data = args.first
  end
  valid? unless cleaned?
end

#to_jsonObject



35
36
37
38
# File 'lib/quandl/data/attributes.rb', line 35

def to_json
  ensure_json_support
  data_array.try(:to_json)
end