Sha256: d0dc0f30da57e55d155578eb057dc726926cc1378f499fe182717b0bb32306f1

Contents?: true

Size: 721 Bytes

Versions: 27

Compression:

Stored size: 721 Bytes

Contents

class LHC::Response::Data
  autoload :Base, 'lhc/response/data/base'
  autoload :Item, 'lhc/response/data/item'
  autoload :Collection, 'lhc/response/data/collection'

  include LHC::Response::Data::Base

  def initialize(response, data: nil)
    @response = response
    @data = data

    if as_json.is_a?(Hash)
      @base = LHC::Response::Data::Item.new(response, data: data)
    elsif as_json.is_a?(Array)
      @base = LHC::Response::Data::Collection.new(response, data: data)
    end
  end

  def method_missing(method, *args, &block)
    @base.send(method, *args, &block)
  end

  def respond_to_missing?(method_name, include_private = false)
    @base.respond_to?(method_name, include_private) || super
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
lhc-9.2.0 lib/lhc/response/data.rb
lhc-9.1.2 lib/lhc/response/data.rb
lhc-9.1.2.pre lib/lhc/response/data.rb
lhc-9.1.1 lib/lhc/response/data.rb
lhc-8.1.1 lib/lhc/response/data.rb
lhc-9.1.0 lib/lhc/response/data.rb
lhc-9.0.0 lib/lhc/response/data.rb
lhc-8.1.0 lib/lhc/response/data.rb
lhc-8.0.0 lib/lhc/response/data.rb
lhc-7.3.3 lib/lhc/response/data.rb
lhc-7.3.2 lib/lhc/response/data.rb
lhc-7.3.1 lib/lhc/response/data.rb
lhc-7.3.0 lib/lhc/response/data.rb
lhc-7.2.0 lib/lhc/response/data.rb
lhc-7.1.0 lib/lhc/response/data.rb
lhc-7.0.1 lib/lhc/response/data.rb
lhc-7.0.0 lib/lhc/response/data.rb
lhc-7.0.0.beta1 lib/lhc/response/data.rb
lhc-6.7.2 lib/lhc/response/data.rb
lhc-6.7.1 lib/lhc/response/data.rb