Sha256: c5ba71697451231ab946fe320b812a08cdc88910376c5f9cdcc0aca371320d94

Contents?: true

Size: 468 Bytes

Versions: 2

Compression:

Stored size: 468 Bytes

Contents

# frozen_string_literal: true

module NovaposhtaApi
  class Model < Hashie::Trash
    include Hashie::Extensions::IndifferentAccess
    include Hashie::Extensions::Coercion
    include Hashie::Extensions::IgnoreUndeclared

    class << self
      def extract_collection(data)
        NovaposhtaApi::Collection.new(data, self)
      end

      def extract_single(data)
        item = data.is_a?(Array) ? data.first : data

        new(item)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
novaposhta_api-0.2.1 lib/novaposhta_api/model.rb
novaposhta_api-0.2.0 lib/novaposhta_api/model.rb