lib/locabulary/json_creator.rb in locabulary-0.3.1 vs lib/locabulary/json_creator.rb in locabulary-0.5.0

- old
+ new

@@ -1,19 +1,18 @@ -require "google/api_client" require "google_drive" require 'highline/import' -require 'locabulary' -require 'locabulary/items' +require 'locabulary/utility' +require 'locabulary/item' require 'json' module Locabulary # Responsible for capturing predicate_name from a given source and writing it to a file class JsonCreator def initialize(document_key, predicate_name, data_fetcher = default_data_fetcher) @document_key = document_key @predicate_name = predicate_name - @output_filepath = Locabulary.filename_for_predicate_name(predicate_name: predicate_name) + @output_filepath = Utility.filename_for_predicate_name(predicate_name) @data_fetcher = data_fetcher end attr_reader :document_key, :predicate_name, :data_fetcher, :spreadsheet_data, :json_data attr_accessor :output_filepath @@ -52,10 +51,10 @@ ->(document_key) { GoogleSpreadsheet.new(document_key).all_rows } end def convert_to_json(data) json_array = data.map do |row| - Locabulary::Items.build(row).to_h + Locabulary::Item.build(row).to_h end @json_data = JSON.pretty_generate("predicate_name" => predicate_name, "values" => json_array) end # :nocov: