lib/hubspot/utils.rb in hubspot-ruby-0.6.0 vs lib/hubspot/utils.rb in hubspot-ruby-0.6.1

- old
+ new

@@ -13,17 +13,21 @@ key_name = opts[:key_name] || "property" hash.map { |k, v| { key_name => k.to_s, "value" => v } } end def dump_properties(klass, hapikey=ENV['HUBSPOT_API_KEY'], filter={}) + Hubspot::Deprecator.build.deprecation_warning("Hubspot::Utils.dump_properties") + with_hapikey(hapikey) do { 'groups' => klass.groups({}, filter), 'properties' => klass.all({}, filter).select { |p| !p['hubspotDefined'] } } end end def restore_properties(klass, hapikey=ENV['HUPSPOT_API_KEY'], properties={}, dry_run=false) + Hubspot::Deprecator.build.deprecation_warning("Hubspot::Utils.restore_properties") + existing_properties = dump_properties(klass, hapikey) skip, new_groups, new_props, update_props = compare_property_lists(klass, properties, existing_properties) puts '', 'Dry Run - Changes will not be applied' if dry_run puts '','Skipping' skip.each { |h| puts "#{h[:reason]} - #{h[:prop]['groupName']}:#{h[:prop]['name']}" }