lib/helio/util.rb in helio-ruby-0.1.0 vs lib/helio/util.rb in helio-ruby-0.2.0

- old
+ new

@@ -1,28 +1,30 @@ +# frozen_string_literal: true + require "cgi" module Helio module Util # Options that a user is allowed to specify. OPTS_USER_SPECIFIED = Set[ :api_id, :api_token, :idempotency_key, :helio_version - ].freeze + ] # Options that should be copyable from one HelioObject to another # including options that may be internal. OPTS_COPYABLE = ( OPTS_USER_SPECIFIED + Set[:api_base] - ).freeze + ) # Options that should be persisted between API requests. This includes # client, which is an object containing an HTTP client to reuse. OPTS_PERSISTABLE = ( OPTS_USER_SPECIFIED + Set[:client] - Set[:idempotency_key] - ).freeze + ) def self.objects_to_ids(h) case h when APIResource h.id @@ -64,10 +66,10 @@ case data when Array data.map { |i| convert_to_helio_object(i, opts) } when Hash # Try converting to a known object class. If none available, fall back to generic HelioObject - object_classes.fetch(data[:object], HelioObject).construct_from(data, opts) + object_classes.fetch(data[:object_type], HelioObject).construct_from(data, opts) else data end end