require_relative 'dfareporting_utils'

def create_creative_field(dfareporting, args)
  # Create a new creative field resource to insert
  creative_field = {
    :advertiserId => args[:advertiser_id],
    :name => 'Example Creative Field'
  }

  # Insert the creative field
  result = dfareporting.creative_fields.insert(
    :profileId => args[:profile_id]
  ).body(creative_field).execute()

  # Display results
  puts 'Created creative field with ID %d and name "%s".' %
      [result.data.id, result.data.name]
end

if __FILE__ == $0
  # Retrieve command line arguments
  args = DfaReportingUtils.get_arguments(ARGV, :profile_id, :advertiser_id)

  # Authenticate and initialize API service
  dfareporting = DfaReportingUtils.setup()

  create_creative_field(dfareporting, args)
end
