lib/bolognese/readers/npm_reader.rb in bolognese-1.3.23 vs lib/bolognese/readers/npm_reader.rb in bolognese-1.4

- old
+ new

@@ -1,9 +1,18 @@ # frozen_string_literal: true module Bolognese module Readers module NpmReader + def get_npm(id: nil, **options) + return { "string" => nil, "state" => "not_found" } unless id.present? + id = normalize_id(id) + response = Maremma.get(id, accept: "json", raw: true) + string = response.body.fetch("data", nil) + + { "string" => string } + end + def read_npm(string: nil, **options) if string.present? errors = jsonlint(string) return { "errors" => errors } if errors.present? end